forked from subutai-io/p2p
/
const.go
149 lines (141 loc) · 5.35 KB
/
const.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// Copyright 2013, Cong Ding. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Author: Cong Ding <dinggnu@gmail.com>
package stun
const (
DefaultServerHost = "stun1.voiceeclipse.net"
DefaultServerPort = 3478
DefaultSoftwareName = "StunClient"
)
const (
magicCookie = 0x2112A442
fingerprint = 0x5354554e
)
type NATType int
const (
NAT_ERROR NATType = iota
NAT_UNKNOWN
NAT_NONE
NAT_BLOCKED
NAT_FULL
NAT_SYMETRIC
NAT_RESTRICTED
NAT_PORT_RESTRICTED
NAT_SYMETRIC_UDP_FIREWALL
)
const (
error_TRY_ALTERNATE = 300
error_BAD_REQUEST = 400
error_UNAUTHORIZED = 401
error_UNASSIGNED_402 = 402
error_FORBIDDEN = 403
error_UNKNOWN_attribute = 420
error_ALLOCATION_MISMATCH = 437
error_STALE_NONCE = 438
error_UNASSIGNED_439 = 439
error_ADDRESS_FAMILY_NOT_SUPPORTED = 440
error_WRONG_CREDENTIALS = 441
error_UNSUPPORTED_TRANSPORT_PROTOCOL = 442
error_PEER_ADDRESS_FAMILY_MISMATCH = 443
error_CONNECTION_ALREADY_EXISTS = 446
error_CONNECTION_TIMEOUT_OR_FAILURE = 447
error_ALLOCATION_QUOTA_REACHED = 486
error_ROLE_CONFLICT = 487
error_SERVER_error = 500
error_INSUFFICIENT_CAPACITY = 508
)
const (
attribute_FAMILY_IPV4 = 0x01
attribute_FAMILY_IPV6 = 0x02
)
const (
attribute_MAPPED_ADDRESS = 0x0001
attribute_RESPONSE_ADDRESS = 0x0002
attribute_CHANGE_REQUEST = 0x0003
attribute_SOURCE_ADDRESS = 0x0004
attribute_CHANGED_ADDRESS = 0x0005
attribute_USERNAME = 0x0006
attribute_PASSWORD = 0x0007
attribute_MESSAGE_INTEGRITY = 0x0008
attribute_ERROR_CODE = 0x0009
attribute_UNKNOWN_attributeS = 0x000A
attribute_REFLECTED_FROM = 0x000B
attribute_CHANNEL_NUMBER = 0x000C
attribute_LIFETIME = 0x000D
attribute_BANDWIDTH = 0x0010
attribute_XOR_PEER_ADDRESS = 0x0012
attribute_DATA = 0x0013
attribute_REALM = 0x0014
attribute_NONCE = 0x0015
attribute_XOR_RELAYED_ADDRESS = 0x0016
attribute_REQUESTED_ADDRESS_FAMILY = 0x0017
attribute_EVEN_PORT = 0x0018
attribute_REQUESTED_TRANSPORT = 0x0019
attribute_DONT_FRAGMENT = 0x001A
attribute_XOR_MAPPED_ADDRESS = 0x0020
attribute_TIMER_VAL = 0x0021
attribute_RESERVATION_TOKEN = 0x0022
attribute_PRIORITY = 0x0024
attribute_USE_CANDIDATE = 0x0025
attribute_PADDING = 0x0026
attribute_RESPONSE_PORT = 0x0027
attribute_CONNECTION_ID = 0x002A
attribute_XOR_MAPPED_ADDRESS_EXP = 0x8020
attribute_SOFTWARE = 0x8022
attribute_ALTERNATE_SERVER = 0x8023
attribute_CACHE_TIMEOUT = 0x8027
attribute_FINGERPRINT = 0x8028
attribute_ICE_CONTROLLED = 0x8029
attribute_ICE_CONTROLLING = 0x802A
attribute_RESPONSE_ORIGIN = 0x802B
attribute_OTHER_ADDRESS = 0x802C
attribute_ECN_CHECK_STUN = 0x802D
attribute_CISCO_FLOWDATA = 0xC000
)
const (
type_BINDING_REQUEST = 0x0001
type_BINDING_RESPONSE = 0x0101
type_BINDING_ERROR_RESPONSE = 0x0111
type_SHARED_SECRET_REQUEST = 0x0002
type_SHARED_SECRET_RESPONSE = 0x0102
type_SHARED_ERROR_RESPONSE = 0x0112
type_ALLOCATE = 0x0003
type_ALLOCATE_RESPONSE = 0x0103
type_ALLOCATE_ERROR_RESPONSE = 0x0113
type_REFRESH = 0x0004
type_REFRESH_RESPONSE = 0x0104
type_REFRESH_ERROR_RESPONSE = 0x0114
type_SEND = 0x0006
type_SEND_RESPONSE = 0x0106
type_SEND_ERROR_RESPONSE = 0x0116
type_DATA = 0x0007
type_DATA_RESPONSE = 0x0107
type_DATA_ERROR_RESPONSE = 0x0117
type_CREATE_PERMISIION = 0x0008
type_CREATE_PERMISIION_RESPONSE = 0x0108
type_CREATE_PERMISIION_ERROR_RESPONSE = 0x0118
type_CHANNEL_BINDING = 0x0009
type_CHANNEL_BINDING_RESPONSE = 0x0109
type_CHANNEL_BINDING_ERROR_RESPONSE = 0x0119
type_CONNECT = 0x000A
type_CONNECT_RESPONSE = 0x010A
type_CONNECT_ERROR_RESPONSE = 0x011A
type_CONNECTION_BIND = 0x000B
type_CONNECTION_BIND_RESPONSE = 0x010B
type_CONNECTION_BIND_ERROR_RESPONSE = 0x011B
type_CONNECTION_ATTEMPT = 0x000C
type_CONNECTION_ATTEMPT_RESPONSE = 0x010C
type_CONNECTION_ATTEMPT_ERROR_RESPONSE = 0x011C
)