-
Notifications
You must be signed in to change notification settings - Fork 5
/
protocol.go
47 lines (37 loc) · 913 Bytes
/
protocol.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
41
42
43
44
45
46
47
package sp3
type AuthenticationMethod int
const (
WEBSOCKET AuthenticationMethod = iota
STUNINJECTION
PATHREFLECTION
)
type Status int
const (
OKAY Status = iota
UNAUTHORIZED // Sender isn't authorized to send to that destination
UNSUPPORTED // Server doesn't support the requested AuthenticationMethod
INVALID // Server failed to parse the message
)
type State int
const (
SENDERHELLO State = iota // Waiting for client Hello message.
HELLORECEIVED
AUTHORIZED // Acceptable ClientAuhtorization received.
)
type SenderHello struct {
DestinationAddress string
AuthenticationMethod AuthenticationMethod
AuthenticationOptions []byte
}
type ServerMessage struct {
Status Status
Challenge string
Sent []byte
}
type SenderAuthorization struct {
DestinationAddress string
Challenge string
}
type SenderMessage struct {
Packet []byte
}