• Stars
    star
    330
  • Rank 127,161 (Top 3 %)
  • Language
    Go
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

๐Ÿ™ High performance WebRTC SFU implemented with pure Go.

Kraken

๐Ÿ™ High performance WebRTC SFU implemented with pure Go.

Architecture

Kraken SFU only supports simple group audio conferencing, more features may be added easily.

Both Unified Plan and RTCP-MUX supported, so that only one UDP port per participant despite the number of participants in a room.

monitor [WIP]

This is the daemon that load balance all engine instances according to their system load, and it will direct all peers in a room to the same engine instance.

engine

The engine handles rooms, all peers in a room should connect to the same engine instance. No need to create rooms, a room is just an ID to distribute streams.

Access the engine with HTTP JSON-RPC, some pseudocode to demonstrate the full procedure.

var roomId = getUrlQueryParameter('room');
var userId = uuidv4();
var trackId;

var pc = new RTCPeerConnection(configuration);

// send ICE candidate to engine
pc.onicecandidate = ({candidate}) => {
  rpc('trickle', [roomId, userId, trackId, JSON.stringify(candidate)]);
};

// play the audio stream when available
pc.ontrack = (event) => {
  el = document.createElement(event.track.kind)
  el.id = aid;
  el.srcObject = stream;
  el.autoplay = true;
  document.getElementById('peers').appendChild(el)
};

// setup local audio stream from microphone
const stream = await navigator.mediaDevices.getUserMedia(constraints);
stream.getTracks().forEach((track) => {
  pc.addTrack(track, stream);
});
await pc.setLocalDescription(await pc.createOffer());

// RPC publish to roomId, with SDP offer
var res = await rpc('publish', [roomId, userId, JSON.stringify(pc.localDescription)]);
// publish should respond an SDP answer
var jsep = JSON.parse(res.data.jsep);
if (jsep.type == 'answer') {
  await pc.setRemoteDescription(jsep);
  trackId = res.data.track;
  subscribe(pc);
}

// RPC subscribe to roomId periodically
async function subscribe(pc) {
  var res = await rpc('subscribe', [roomId, userId, trackId]);
  var jsep = JSON.parse(res.data.jsep);
  if (jsep.type == 'offer') {
    await pc.setRemoteDescription(jsep);
    var sdp = await pc.createAnswer();
    await pc.setLocalDescription(sdp);
    // RPC anwser the subscribe offer
    await rpc('answer', [roomId, userId, trackId, JSON.stringify(sdp)]);
  }
  setTimeout(function () {
    subscribe(pc);
  }, 3000);
}

async function rpc(method, params = []) {
  const response = await fetch('http://localhost:7000', {
    method: 'POST',
    mode: 'cors',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({id: uuidv4(), method: method, params: params})
  });
  return response.json();
}

Quick Start

Setup Golang development environment at first.

git clone https://github.com/MixinNetwork/kraken
cd kraken && go build

cp config/engine.example.toml config/engine.toml
ip address # get your network interface name, edit config/engine.toml

./kraken -c config/engine.toml -s engine

Get the source code of either kraken.fm or Mornin, follow their guides to use your local kraken API.

Community

Kraken is built with Pion, we have discussions over their Slack.

More Repositories

1

mixin

๐Ÿš€ The Mixin TEE-BFT-DAG network reference implementation.
Go
508
star
2

ios-app

๐Ÿ“ฑiOS private messenger, crypto wallet and light node to Mixin Network
Swift
497
star
3

android-app

๐Ÿ“ฑ Android private messenger, crypto wallet and light node to Mixin Network
Kotlin
456
star
4

flutter-plugins

๐Ÿงฑ Flutter plugins used in Mixin Messenger.
C
436
star
5

flutter-app

๐Ÿ’ป Mixin Messenger desktop app for macOS, iPadOS, Linux, and Windows powered by Flutter/Dart.
Dart
281
star
6

ocean.one

๐ŸŒŠ Ocean ONE is a decentralized exchange built on Mixin Network
Go
186
star
7

libsignal_protocol_dart

Signal Protocol library for Dart/Flutter
Dart
157
star
8

developers.mixin.one

๐Ÿ“’ The Mixin Developers dashboard and docs.
JavaScript
128
star
9

desktop-app

[DEPRECATED]๐Ÿ’ป Mixin Messenger desktop app for Windows, macOS, and Linux powered by Electron.
JavaScript
88
star
10

bot-api-go-client

๐Ÿค–๏ธ Mixin API for Go
Go
71
star
11

tip

๐Ÿ”‘ A decentralized key derivation protocol for simple passphrase.
Go
51
star
12

mixin.one

โ„น๏ธ The website of Mixin core team and Mixin Network explorer
TypeScript
49
star
13

kraken.fm

Kraken is an instant and anonymous audio conferencing service
JavaScript
42
star
14

supergroup.mixin.one

๐Ÿš Mixin Super Group Source Code
Go
32
star
15

mixin-wallet

๐Ÿ‘› An open-source cryptocurrency wallet bot based on Mixin API, which supports almost all popular cryptocurrencies.
Dart
30
star
16

trusted-group

๐Ÿช Mixin Trusted Group makes decentralized applications on Mixin Messenger and Kernel.
Go
28
star
17

logs

updates and announcements
Shell
25
star
18

donate.cafe

โ˜•๏ธ Accept bitcoin donations now
Vue
19
star
19

multisig-bot

A client only bot to demonstrate the multisig feature of Mixin Messenger.
Go
18
star
20

nfo

๐Ÿ† A decentralized layer to support NFT on Mixin Messenger and Kernel.
Go
17
star
21

asset-profile

asset icon and price in Mixin Messenger
16
star
22

bot-api-nodejs-client

Mixin API for JavaScript & Node.js
TypeScript
14
star
23

bot-api-js-client

Mixin bot API for Javascript
JavaScript
13
star
24

safe

๐Ÿฆ A multiplex cold wallet with multisig and MPC.
Go
12
star
25

bot-manager

Vue
11
star
26

supergroup-bot

Go
9
star
27

mixin_bot_sdk_dart

Dart/Flutter SDK for Mixin
Dart
6
star
28

mobilecoin-go

MobileCoin utilities in Golang
Go
5
star
29

audits

๐Ÿšจ Security audits for all the repositories.
5
star
30

mvm-contracts

Solidity
4
star
31

mixin.network

The website to showcase the ecosystem of Mixin Network
4
star
32

mvm.app

The website of Mixin Virtual Machine.
TypeScript
4
star
33

flutter_pasteboard

Dart
4
star
34

bot-api-kotlin-client

Mixin bot SDK for Java/Kotlin
Kotlin
4
star
35

near-sdk-go

Go
4
star
36

developer-competition

3
star
37

mixswap_sdk_dart

MixSwap Dart SDK
Dart
3
star
38

safe-go-sdk

Go
2
star
39

mips

Messenger Improvement Proposals
2
star
40

tink-eddsa

Kotlin
2
star
41

governance

Go
2
star
42

mixin-testnet-setup

Mixin Testnet Faucet
2
star
43

bridge.mvm.app

TypeScript
2
star
44

mvm.dev

MVM (Mixin Virtual Machine) document
JavaScript
2
star
45

mixin-rust-sdk

๐Ÿฆ€๏ธ
Rust
2
star
46

githook-bot

A Mixin Messenger bot for GitHub Webhooks
JavaScript
2
star
47

bot-api-swift-client

Swift
1
star
48

go-number

A golang number library
Go
1
star
49

monero-core

C++
1
star
50

shop

JavaScript
1
star
51

handsaw

A tool for generating i18n strings for multiple platforms.
Kotlin
1
star