core

package
v1.0.1-0...-968bb1a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package core We will implement the popular open source project barrier kvm To ensure we can connect clients keyboard and mouse to the server while ScreenShare is taking place

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BroadcastServerToBackend

func BroadcastServerToBackend() error

BroadcastServerToBackend Broadcasts server information for the backend

func DetectBarrier

func DetectBarrier() error

DetectBarrier This function ensures that the server has barrier client installed

func EscapeNAT

func EscapeNAT(ScreenPort, GameplayServerPort string) (ServerPort string, ScreenSharePort string, err error)

EscapeNAT Func to escape NAT - 1 port for server - 2 port for barrierKVM

func EscapeNATBarrier

func EscapeNATBarrier() (barrierKVMport string, err error)

func GetHttp

func GetHttp() *http.ServeMux

func GetRandomName

func GetRandomName(retry int) string

func Ip4or6

func Ip4or6(s string) string

Ip4or6 Helper function to check if the IP address is IPV4 or IPV6 (https://socketloop.com/tutorials/golang-check-if-ip-address-is-version-4-or-6)

func RemoveRoom

func RemoveRoom(id string)

func StringPrettyPrint

func StringPrettyPrint(data interface{}) (string, error)

StringPrettyPrint print the contents of the obj ( Reference: https://stackoverflow.com/questions/24512112/how-to-print-struct-variables-in-console

Types

type Barrier

type Barrier struct {
	NodeName  string
	IPAddress string
	Mode      string
	Process   *exec.Cmd
}

Barrier It's preferred that the IP address used is a IPV6 address

func (*Barrier) CreateBarrierSession

func (b *Barrier) CreateBarrierSession() error

CreateBarrierSession Command to run "barrier.barrierc --debug INFO -f 192.168.0.175"

func (*Barrier) DeleteBarrierSession

func (b *Barrier) DeleteBarrierSession() error

DeleteBarrierSession Deletes barrier client session running

type GameSession

type GameSession struct {
	Link   string          `json:"LinkID"`
	Rate   float64         `json:"Rate"`
	Server *server.SysInfo `json:"ServerInformation"`
}

GameSession A single Game session. In the following implementation the server can have only 1 user occupying it por session.

type Room

type Room struct {
	ID             string `json:"id"`
	Sessions       map[string]*StreamSession
	CallerConn     *websocket.Conn
	BarrierSession *Barrier
}

func GetRoom

func GetRoom(id string) *Room

func NewRoom

func NewRoom(callerConn *websocket.Conn) *Room

func ReadRoomsFile

func ReadRoomsFile() (*Room, error)

ReadRoomsFile Reads rooms file and return struct room id

func (*Room) GetSession

func (room *Room) GetSession(id string) *StreamSession

func (*Room) NewSession

func (room *Room) NewSession(calleeConn *websocket.Conn) *StreamSession

type StreamSession

type StreamSession struct {
	ID                  string
	Offer               string
	Answer              string
	CallerIceCandidates []string
	CalleeIceCandidates []string
	CallerConn          *websocket.Conn
	CalleeConn          *websocket.Conn
}

type WSMessage

type WSMessage struct {
	SessionID string
	Type      string
	Value     string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL