|
|
@@ -39,6 +39,7 @@ const (
|
|
39
|
39
|
ConnectionTypeUnknown ConnectionType = iota
|
|
40
|
40
|
ConnectionTypeAbridged
|
|
41
|
41
|
ConnectionTypeIntermediate
|
|
|
42
|
+ ConnectionTypeSecure
|
|
42
|
43
|
)
|
|
43
|
44
|
|
|
44
|
45
|
// ConnectionProtocol* define which connection protocols to use.
|
|
|
@@ -53,6 +54,7 @@ const (
|
|
53
|
54
|
var (
|
|
54
|
55
|
ConnectionTagAbridged = []byte{0xef, 0xef, 0xef, 0xef}
|
|
55
|
56
|
ConnectionTagIntermediate = []byte{0xee, 0xee, 0xee, 0xee}
|
|
|
57
|
+ ConnectionTagSecure = []byte{0xdd, 0xdd, 0xdd, 0xdd}
|
|
56
|
58
|
)
|
|
57
|
59
|
|
|
58
|
60
|
// Tag maps connection type to the corresponding handshake tag.
|
|
|
@@ -62,6 +64,8 @@ func (t ConnectionType) Tag() ([]byte, error) {
|
|
62
|
64
|
return ConnectionTagAbridged, nil
|
|
63
|
65
|
case ConnectionTypeIntermediate:
|
|
64
|
66
|
return ConnectionTagIntermediate, nil
|
|
|
67
|
+ case ConnectionTypeSecure:
|
|
|
68
|
+ return ConnectionTagSecure, nil
|
|
65
|
69
|
default:
|
|
66
|
70
|
return nil, errors.Errorf("Unknown connection type %d", t)
|
|
67
|
71
|
}
|
|
|
@@ -75,6 +79,9 @@ func ConnectionTagFromHandshake(magic []byte) (ConnectionType, error) {
|
|
75
|
79
|
if bytes.Equal(magic, ConnectionTagAbridged) {
|
|
76
|
80
|
return ConnectionTypeAbridged, nil
|
|
77
|
81
|
}
|
|
|
82
|
+ if bytes.Equal(magic, ConnectionTagSecure) {
|
|
|
83
|
+ return ConnectionTypeSecure, nil
|
|
|
84
|
+ }
|
|
78
|
85
|
|
|
79
|
86
|
return ConnectionTypeUnknown, errors.New("Unknown handshake protocol")
|
|
80
|
87
|
}
|