格式化
This commit is contained in:
@@ -0,0 +1,109 @@
|
||||
package constants
|
||||
|
||||
import "time"
|
||||
|
||||
const (
|
||||
AgentUserAgent = "miaomiaowux/0.1"
|
||||
)
|
||||
|
||||
const (
|
||||
HeaderAuthorization = "Authorization"
|
||||
HeaderContentType = "Content-Type"
|
||||
HeaderMMRemoteToken = "MM-Remote-Token"
|
||||
HeaderUserAgent = "User-Agent"
|
||||
ContentTypeJSON = "application/json"
|
||||
BearerPrefix = "Bearer "
|
||||
)
|
||||
|
||||
const (
|
||||
ConnectionModeAuto = "auto"
|
||||
ConnectionModePull = "pull"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultListenPort = "23889"
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultTrafficReportInterval = 1 * time.Minute
|
||||
DefaultSpeedReportInterval = 3 * time.Second
|
||||
DefaultHTTPClientTimeout = 10 * time.Second
|
||||
DefaultReadTimeout = 30 * time.Second
|
||||
DefaultShutdownTimeout = 10 * time.Second
|
||||
DefaultRPCShortTimeout = 5 * time.Second
|
||||
)
|
||||
|
||||
const (
|
||||
DefaultMetricsHost = "127.0.0.1"
|
||||
DefaultMetricsPort = 38889
|
||||
DefaultMetricsListen = "127.0.0.1:38889"
|
||||
LocalhostIP = "127.0.0.1"
|
||||
)
|
||||
|
||||
const (
|
||||
WebSocketMaxConsecutiveFailures = 5
|
||||
WebSocketMaxAuthFailures = 10
|
||||
AuthFailureSleepBackoff = 30 * time.Minute
|
||||
PullModeTrafficReportThreshold = 30 * time.Second
|
||||
)
|
||||
|
||||
const (
|
||||
ReconnectBaseBackoff = 5 * time.Second
|
||||
ReconnectMaxBackoff = 5 * time.Minute
|
||||
AuthFailureBackoffStep = 30 * time.Second
|
||||
AuthFailureMaxBackoff = 10 * time.Minute
|
||||
AutoModePullFallbackBackoff = 30 * time.Second
|
||||
WebSocketHandshakeTimeout = 10 * time.Second
|
||||
WebSocketReadDeadline = 10 * time.Second
|
||||
WebSocketHeartbeatInterval = 30 * time.Second
|
||||
WebSocketIdleDeadline = 5 * time.Minute
|
||||
)
|
||||
|
||||
const (
|
||||
DomainProbeDefaultTimeoutMS = 2000
|
||||
DomainProbeMinTimeoutMS = 200
|
||||
DomainProbeMaxTimeoutMS = 10000
|
||||
DomainProbeMaxCount = 200
|
||||
DomainProbeConcurrency = 16
|
||||
)
|
||||
|
||||
var (
|
||||
NginxPrimaryPrefixDir = "/usr/local/nginx"
|
||||
|
||||
DefaultXrayConfigPaths = []string{
|
||||
"/usr/local/etc/xray/config.json",
|
||||
"/etc/xray/config.json",
|
||||
"/opt/xray/config.json",
|
||||
}
|
||||
XrayConfigDirPaths = []string{
|
||||
"/usr/local/etc/xray",
|
||||
"/etc/xray",
|
||||
"/opt/xray",
|
||||
}
|
||||
DefaultNginxConfigPaths = []string{
|
||||
"/etc/nginx/nginx.conf",
|
||||
"/usr/local/nginx/conf/nginx.conf",
|
||||
}
|
||||
NginxConfigDirPaths = []string{
|
||||
"/etc/nginx",
|
||||
"/etc/nginx/sites-available",
|
||||
"/etc/nginx/sites-enabled",
|
||||
"/etc/nginx/conf.d",
|
||||
"/usr/local/nginx/conf",
|
||||
}
|
||||
NginxSSLServerDirPaths = []string{
|
||||
"/usr/local/nginx/servers",
|
||||
"/usr/local/nginx/conf/servers",
|
||||
"/etc/nginx/servers",
|
||||
"/etc/nginx/conf.d",
|
||||
}
|
||||
XrayBinarySearchPaths = []string{
|
||||
"/usr/local/bin/xray",
|
||||
"/usr/bin/xray",
|
||||
"/opt/xray/xray",
|
||||
}
|
||||
NginxBinarySearchPaths = []string{
|
||||
"/usr/local/nginx/sbin/nginx",
|
||||
"nginx",
|
||||
}
|
||||
)
|
||||
@@ -0,0 +1,43 @@
|
||||
package constants
|
||||
|
||||
const (
|
||||
PathHealth = "/health"
|
||||
)
|
||||
|
||||
const (
|
||||
PathChildTraffic = "/api/child/traffic"
|
||||
PathChildSpeed = "/api/child/speed"
|
||||
PathChildServiceStats = "/api/child/services/status"
|
||||
PathChildServiceCtl = "/api/child/services/control"
|
||||
PathChildXrayInstall = "/api/child/xray/install"
|
||||
PathChildXrayRemove = "/api/child/xray/remove"
|
||||
PathChildXrayConfig = "/api/child/xray/config"
|
||||
PathChildXraySysCfg = "/api/child/xray/system-config"
|
||||
PathChildXrayCfgFiles = "/api/child/xray/config-files"
|
||||
PathChildNginxInstall = "/api/child/nginx/install"
|
||||
PathChildNginxRemove = "/api/child/nginx/remove"
|
||||
PathChildNginxConfig = "/api/child/nginx/config"
|
||||
PathChildNginxCfgFile = "/api/child/nginx/config-files"
|
||||
PathChildSystemInfo = "/api/child/system/info"
|
||||
PathChildInbounds = "/api/child/inbounds"
|
||||
PathChildOutbounds = "/api/child/outbounds"
|
||||
PathChildRouting = "/api/child/routing"
|
||||
PathChildScan = "/api/child/scan"
|
||||
PathChildCertDeploy = "/api/child/cert/deploy"
|
||||
PathChildNginxSetup = "/api/child/nginx/setup-ssl"
|
||||
PathChildDomainProbe = "/api/child/domains/latency"
|
||||
)
|
||||
|
||||
const (
|
||||
PathChildXrayInstallStream = "/api/child/xray/install-stream"
|
||||
PathChildXrayRemoveStream = "/api/child/xray/remove-stream"
|
||||
PathChildNginxInstallSSE = "/api/child/nginx/install-stream"
|
||||
PathChildNginxRemoveSSE = "/api/child/nginx/remove-stream"
|
||||
)
|
||||
|
||||
const (
|
||||
PathRemoteWebSocket = "/api/remote/ws"
|
||||
PathRemoteHeartbeat = "/api/remote/heartbeat"
|
||||
PathRemoteTraffic = "/api/remote/traffic"
|
||||
PathRemoteSpeed = "/api/remote/speed"
|
||||
)
|
||||
Reference in New Issue
Block a user