Build way-node / Test, Build, Push (push) Failing after 14s
- Go module: github.com/cedar2025/xboard-node → github.com/viaeon/way-node(307 处 import 同步) - cmd/xboard-node/ → cmd/way-node/ - install.sh: APP_NAME / INSTALL_ROOT(/etc/way-node) / BINARY_PATH / SERVICE_NAME 全部更名, 下载源与 Documentaion 指向 git.viaeon.com/admin/way-node - Makefile / Dockerfile 产物与镜像路径更名 - README 全篇重写链接 - 新增 .gitea/workflows/build.yml:容器内跑测试 + 交叉编译 + 构建镜像推 git.viaeon.com/admin/way-node 构建全程在 golang:1.26 容器里,不依赖 runner 宿主装 Go - 禁用 .github/workflows/ci.yml(依赖 ghcr.io 与 GITHUB_TOKEN,Gitea 上跑不通) 保留:xbctl 工具名(不含旧品牌)、go.sum 里上游依赖哈希
134 lines
2.3 KiB
Go
134 lines
2.3 KiB
Go
package model
|
|
|
|
import "github.com/viaeon/way-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
|
|
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
|
|
}
|