-
Notifications
You must be signed in to change notification settings - Fork 167
Expand file tree
/
Copy pathtypes.go
More file actions
134 lines (116 loc) · 2.35 KB
/
Copy pathtypes.go
File metadata and controls
134 lines (116 loc) · 2.35 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
package model
import "github.com/cedar2025/xboard-node/internal/config"
type NodeSpec struct {
Protocol string
ListenIP string
ServerPort int
Network string
NetworkSettings map[string]any
Routes []RouteRule
KernelType string
KernelLogLevel string
CustomOutbounds []OutboundConfig
CustomRoutes []map[string]any
CustomRouteRules []CustomRouteRule
CertConfig *config.CertConfig
AutoTLS bool
Domain string
Cipher string
Plugin string
PluginOpt string
ServerKey string
TLS int
Flow string
Decryption string
TLSSettings map[string]any
Host string
ServerName string
Version int
UpMbps int
DownMbps int
Obfs string
ObfsPassword string
CongestionControl string
PaddingScheme string
Transport string
TrafficPattern string
Multiplex *MultiplexConfig
AcceptProxyProtocol bool
}
type OutboundConfig struct {
Tag string
Protocol string
Settings map[string]any
StreamSettings map[string]any
ProxyTag string
}
type RouteRule struct {
ID int
Match []string
Action string
ActionValue string
}
type MultiplexConfig struct {
Enabled bool
Protocol string
MaxConnections int
MinStreams int
MaxStreams int
Padding bool
Brutal *BrutalConfig
}
type BrutalConfig struct {
Enabled bool
UpMbps int
DownMbps int
}
type UserSpec struct {
ID int
UUID string
SpeedLimit int
DeviceLimit int
}
func (n *NodeSpec) GetProxyProtocol() bool {
if n == nil {
return false
}
if n.AcceptProxyProtocol {
return true
}
if n.NetworkSettings != nil {
if v, ok := n.NetworkSettings["acceptProxyProtocol"]; ok {
if b, ok := v.(bool); ok {
return b
}
}
}
return false
}
func cloneAnyMap(src map[string]any) map[string]any {
if len(src) == 0 {
return nil
}
out := make(map[string]any, len(src))
for k, v := range src {
out[k] = v
}
return out
}
func cloneMapSlice(src []map[string]any) []map[string]any {
if len(src) == 0 {
return nil
}
out := make([]map[string]any, 0, len(src))
for _, item := range src {
out = append(out, cloneAnyMap(item))
}
return out
}
func cloneStringSlice(src []string) []string {
if len(src) == 0 {
return nil
}
out := make([]string, len(src))
copy(out, src)
return out
}