-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfacade.go
More file actions
223 lines (180 loc) · 7.87 KB
/
Copy pathfacade.go
File metadata and controls
223 lines (180 loc) · 7.87 KB
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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
package ivnp
import (
"gosuda.org/ivnp/client"
"gosuda.org/ivnp/interfaces/destination"
"gosuda.org/ivnp/networking"
"gosuda.org/ivnp/node"
"gosuda.org/ivnp/state"
)
// Config represents the operating configuration for an IVNP node.
type Config = state.ConfigurationOperating
type LogConfig = state.ConfigurationLog
func LoadConfig(path string) (Config, error) { return state.ConfigurationLoadOperating(path) }
func LoadOrCreateConfig(path string) (Config, error) {
return state.ConfigurationLoadOrCreateOperating(path)
}
func ParseConfig(text, path string) (Config, error) {
return state.ConfigurationParseOperating(text, path)
}
// Node represents an embedded IVNP router node and its associated services.
type Node = node.Subsystem
type (
Options = node.Options
Status = node.Status
Destination = client.ClientDestination
DestinationStatus = client.ClientStatus
DestinationPolicy = node.DestinationPolicy
DestinationKind = node.DestinationPolicyKind
)
const (
DestinationPublicLS2 = node.DestinationPublicLeaseSet2
DestinationEncryptedNone = node.DestinationEncryptedWithoutAuth
DestinationEncryptedDH = node.DestinationEncryptedWithDiffieHellman
DestinationEncryptedPSK = node.DestinationEncryptedWithPreSharedKey
)
// New initializes an embedded IVNP node with the given configuration and options.
func New(cfg Config, options Options) (*Node, error) { return node.NewSubsystem(cfg, options) }
type (
DestinationResolver = destination.DestinationResolver
LeaseSetPolicy = destination.LeaseSetPolicy
DestinationSpec = destination.DestinationSpec
DestinationRoute = destination.DestinationRoute
ReceivedMessage = destination.ReceivedMessage
MessageSubscription = destination.MessageSubscription
DestinationEndpoint = destination.DestinationEndpoint
DestinationController = destination.DestinationController
ReadyDestinationEndpoint = destination.ReadyDestinationEndpoint
BoundedDestinationEndpoint = destination.BoundedDestinationEndpoint
SourcePortDestinationEndpoint = destination.SourcePortDestinationEndpoint
ByteBudget = destination.ByteBudget
)
type (
Router = networking.Router
RouterConfig = networking.RouterConfig
RouterDependencies = networking.RouterDependencies
RouterStatus = networking.RouterStatus
RouterEndpoint = networking.RouterEndpoint
RouterState = networking.RouterState
Reachability = networking.RouterReachability
)
func NewRouter(cfg RouterConfig, dependencies RouterDependencies) (*Router, error) {
return networking.RouterNew(cfg, dependencies)
}
type (
Database = networking.NetworkDatabase
RouterInfo = networking.NetworkDatabaseRouterInfo
RouterAddress = networking.NetworkDatabaseRouterAddress
Lease = networking.NetworkDatabaseLease
LeaseSet = networking.NetworkDatabaseLeaseSet
LeaseSet2 = networking.NetworkDatabaseLeaseSet2
EncryptedLeaseSet = networking.NetworkDatabaseEncryptedLeaseSet
MetaLeaseSet = networking.NetworkDatabaseMetaLeaseSet
RouterRef = networking.NetworkDatabaseRouterRef
)
func NewDatabase(local Hash, bucketCapacity int) *Database {
return networking.NetworkDatabaseNewDatabase(local, bucketCapacity)
}
func ParseRouterInfo(src []byte) (RouterInfo, error) {
return networking.NetworkDatabaseParseRouterInfo(src)
}
func ParseRouterAddress(src []byte) (RouterAddress, int, error) {
return networking.NetworkDatabaseParseRouterAddress(src)
}
func ParseLeaseSet(src []byte) (LeaseSet, error) { return networking.NetworkDatabaseParseLeaseSet(src) }
func ParseLeaseSet2(src []byte) (LeaseSet2, error) {
return networking.NetworkDatabaseParseLeaseSet2(src)
}
func ParseEncryptedLeaseSet(src []byte) (EncryptedLeaseSet, error) {
return networking.NetworkDatabaseParseEncryptedLeaseSet(src)
}
func ParseMetaLeaseSet(src []byte) (MetaLeaseSet, error) {
return networking.NetworkDatabaseParseMetaLeaseSet(src)
}
type (
I2NPMessage = networking.I2NPMessage
I2NPHeader = networking.I2NPHeader
I2NPShortHeader = networking.I2NPShortHeader
I2NPTransportHeader = networking.I2NPTransportHeader
I2NPMessageType = networking.I2NPMessageType
I2NPStoreType = networking.I2NPStoreType
I2NPDataMessage = networking.I2NPDataMessage
I2NPGarlicMessage = networking.I2NPGarlicMessage
I2NPDatabaseStoreMessage = networking.I2NPDatabaseStoreMessage
I2NPDatabaseLookup = networking.I2NPDatabaseLookupMessage
I2NPTunnelDataMessage = networking.I2NPTunnelDataMessage
I2NPTunnelGatewayMessage = networking.I2NPTunnelGatewayMessage
)
func ParseI2NP(src []byte) (I2NPMessage, int, error) { return networking.I2NPParse(src) }
func ParseI2NPWire(src []byte) (I2NPMessage, int, error) { return networking.I2NPParseWire(src) }
func ParseI2NPData(payload []byte) (I2NPDataMessage, error) { return networking.I2NPParseData(payload) }
func ParseI2NPGarlic(payload []byte) (I2NPGarlicMessage, error) {
return networking.I2NPParseGarlic(payload)
}
func ParseI2NPDatabaseStore(payload []byte) (I2NPDatabaseStoreMessage, error) {
return networking.I2NPParseDatabaseStore(payload)
}
func ParseI2NPDatabaseLookup(payload []byte) (I2NPDatabaseLookup, error) {
return networking.I2NPParseDatabaseLookup(payload)
}
func ParseI2NPTunnelData(payload []byte) (I2NPTunnelDataMessage, error) {
return networking.I2NPParseTunnelData(payload)
}
func ParseI2NPTunnelGateway(payload []byte) (I2NPTunnelGatewayMessage, error) {
return networking.I2NPParseTunnelGateway(payload)
}
type (
TunnelRuntime = networking.TunnelRuntime
TunnelRuntimeConfig = networking.TunnelRuntimeConfig
TunnelPool = networking.TunnelPool
TunnelEntry = networking.TunnelEntry
TunnelDirection = networking.TunnelDirection
TunnelSender = networking.TunnelSender
GarlicReplyKey = networking.GarlicReplyKey
GarlicReplyKeys = networking.GarlicReplyKeyRegistryContract
StreamingDelivery = destination.Delivery
)
const (
TunnelInbound = networking.TunnelInbound
TunnelOutbound = networking.TunnelOutbound
)
func NewTunnelRuntime(cfg TunnelRuntimeConfig) *TunnelRuntime {
return networking.TunnelNewRuntime(cfg)
}
func NewTunnelPool(maximum int) *TunnelPool { return networking.TunnelNewPool(maximum) }
func NewOwnedTunnelPool(owner Hash, maximum int) *TunnelPool {
return networking.TunnelNewOwnedPool(owner, maximum)
}
func NewGarlicReplyKeyRegistry(maximum int) *networking.GarlicReplyKeyRegistry {
return networking.GarlicNewReplyKeyRegistry(maximum)
}
type (
SAMNetwork = client.SimpleAnonymousMessagingNetwork
SAMConfig = client.SimpleAnonymousMessagingConfig
SAMServer = client.SimpleAnonymousMessagingServer
SAMServerConfig = client.SimpleAnonymousMessagingServerConfig
HTTPProxy = client.ClientHTTPProxy
HTTPProxyConfig = client.ClientHTTPProxyConfig
SOCKS5Proxy = client.ClientSOCKS5Proxy
SOCKS5Config = client.ClientSOCKS5Config
ControlServer = client.ClientControl
ControlConfig = client.ClientControlConfig
RegistrationSigner = client.RegistrationSigner
)
var (
ErrRegistrationDomain = client.RegistrationErrDomain
RegistrationAuthentication = client.RegistrationAuthentication
RegistrationEd25519Signer = client.RegistrationEd25519Signer
)
func NewSAMNetwork(cfg SAMConfig) (*SAMNetwork, error) {
return client.SimpleAnonymousMessagingNew(cfg)
}
func NewSAMServer(cfg SAMServerConfig) (*SAMServer, error) {
return client.SimpleAnonymousMessagingNewServer(cfg)
}
func NewHTTPProxy(cfg HTTPProxyConfig) (*HTTPProxy, error) { return client.ClientNewHTTPProxy(cfg) }
func NewSOCKS5Proxy(cfg SOCKS5Config) (*SOCKS5Proxy, error) {
return client.ClientNewSOCKS5Proxy(cfg)
}
func NewControlServer(cfg ControlConfig) (*ControlServer, error) {
return client.ClientNewControl(cfg)
}