* fix: prevent duplicate call link detection (#23) Co-authored-by: Maksim <maksim@MacBook-Pro-Maksim.local> * bot improvements (#25) Co-authored-by: Maksim <maksim@MBP-Maksim.lan> * headless vk video creator * add scroll to logs * allow peer reconnection * add todo about topology changes, kick stale peer to prevent SFU topology * unified relay for headless * remove relay binaries, extend build-go.sh to build them * refactor constants * limit headless resource usage * nuke everyone and yourself at sfu topology changes * add headless for creator * save bot enabled state * increment release version --------- Co-authored-by: Nevenuga <80585376+Nevenuga@users.noreply.github.com> Co-authored-by: Maksim <maksim@MacBook-Pro-Maksim.local> Co-authored-by: Maksim <maksim@MBP-Maksim.lan> Co-authored-by: kulikov <user@Mac.lan>
49 lines
1.5 KiB
Go
49 lines
1.5 KiB
Go
package main
|
|
|
|
import "github.com/pion/webrtc/v4"
|
|
|
|
// Tunnel frame protocol constants shared between DC and video relay paths.
|
|
// Frame format: connID(4) + msgType(1) + payload
|
|
const (
|
|
msgConnect byte = 0x01
|
|
msgConnectOK byte = 0x02
|
|
msgConnectErr byte = 0x03
|
|
msgData byte = 0x04
|
|
msgClose byte = 0x05
|
|
msgUDP byte = 0x06
|
|
msgUDPReply byte = 0x07
|
|
|
|
socksVer = 0x05
|
|
socksCmdTCP = 0x01
|
|
socksCmdUDP = 0x03
|
|
socksAtypIPv4 = 0x01
|
|
socksAtypDomain = 0x03
|
|
socksAtypIPv6 = 0x04
|
|
|
|
socksHandshakeBuf = 258
|
|
udpBufSize = 4096
|
|
rtpBufSize = 65536
|
|
vp8RelayBufSize = 900
|
|
)
|
|
|
|
var (
|
|
socksNoAuth = []byte{socksVer, 0x00}
|
|
socksOK = []byte{socksVer, 0x00, 0x00, socksAtypIPv4, 0, 0, 0, 0, 0, 0}
|
|
socksConnFail = []byte{socksVer, 0x05, 0x00, socksAtypIPv4, 0, 0, 0, 0, 0, 0}
|
|
socksCmdErr = []byte{socksVer, 0x07, 0x00, socksAtypIPv4, 0, 0, 0, 0, 0, 0}
|
|
socksAddrErr = []byte{socksVer, 0x08, 0x00, socksAtypIPv4, 0, 0, 0, 0, 0, 0}
|
|
socksGenFail = []byte{socksVer, 0x01, 0x00, socksAtypIPv4, 0, 0, 0, 0, 0, 0}
|
|
)
|
|
|
|
// Relay is the common interface for DCRelay and VideoRelay.
|
|
type Relay interface {
|
|
Init(iceServers []webrtc.ICEServer) error
|
|
CreateOffer() (webrtc.SessionDescription, error)
|
|
CreateAnswer() (webrtc.SessionDescription, error)
|
|
SetRemoteDescription(sdpType webrtc.SDPType, sdp string) error
|
|
AddICECandidate(candidate webrtc.ICECandidateInit) error
|
|
OnICECandidate(fn func(*webrtc.ICECandidate))
|
|
OnConnectionStateChange(fn func(webrtc.PeerConnectionState))
|
|
Close()
|
|
}
|