-
Notifications
You must be signed in to change notification settings - Fork 0
/
models.go
40 lines (31 loc) · 903 Bytes
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package blastoff
import (
"github.com/codecat/go-enet"
"github.com/google/uuid"
)
type bridgePacket struct {
packet enet.Packet
channelID uint8
}
type peerData struct {
Peer enet.Peer
PacketChannel chan bridgePacket
CloseSignal chan bool
}
type BlastoffServer struct {
Address enet.Address
remoteAddressMap map[uuid.UUID]enet.Address
peerMap map[enet.Peer]peerData
}
// This channel is used for the Remote to communicate with the Blastoff server
const RemoteAdminChannelId uint8 = 249
// Commands which the Remote can send to the Blastoff server
type ServerCommandFlag uint8
const (
// Request Blastoff to instantiate a new remote instance
ServerCommandNewInstance ServerCommandFlag = iota
// Confirm Blastoff to bridge connection
ServerCommandValidateClient
// Request Blastoff to redirect client to another remote
ServerCommandRedirectClient
)