refactor(api): remove Ratio field from NodeConfig and related structures
This commit is contained in:
parent
0d1df5f905
commit
0179e9837c
@ -36,7 +36,6 @@ type (
|
||||
Name string `json:"name"`
|
||||
Country string `json:"country"`
|
||||
City string `json:"city"`
|
||||
Ratio float32 `json:"ratio"`
|
||||
Address string `json:"address"`
|
||||
Sort int `json:"sort"`
|
||||
Protocols []Protocol `json:"protocols"`
|
||||
@ -49,7 +48,6 @@ type (
|
||||
Name string `json:"name"`
|
||||
Country string `json:"country,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Ratio float32 `json:"ratio"`
|
||||
Address string `json:"address"`
|
||||
Sort int `json:"sort,omitempty"`
|
||||
Protocols []Protocol `json:"protocols"`
|
||||
@ -59,7 +57,6 @@ type (
|
||||
Name string `json:"name"`
|
||||
Country string `json:"country,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Ratio float32 `json:"ratio"`
|
||||
Address string `json:"address"`
|
||||
Sort int `json:"sort,omitempty"`
|
||||
Protocols []Protocol `json:"protocols"`
|
||||
|
||||
@ -94,18 +94,18 @@ type (
|
||||
Users []OnlineUser `json:"users"`
|
||||
}
|
||||
QueryServerConfigRequest {
|
||||
ServerID int64 `path:"server_id"`
|
||||
SecretKey string `form:"secret_key"`
|
||||
ServerID int64 `path:"server_id"`
|
||||
SecretKey string `form:"secret_key"`
|
||||
Protocols []string `form:"protocols,omitempty"`
|
||||
}
|
||||
QueryServerConfigResponse {
|
||||
TrafficReportThreshold int64 `json:"traffic_report_threshold"`
|
||||
IPStrategy string `json:"ip_strategy"`
|
||||
DNS []NodeDNS `json:"dns"`
|
||||
Block []string `json:"block"`
|
||||
Outbound []NodeOutbound `json:"outbound"`
|
||||
Protocols []Protocol `json:"protocols"`
|
||||
Total int64 `json:"total"`
|
||||
TrafficReportThreshold int64 `json:"traffic_report_threshold"`
|
||||
IPStrategy string `json:"ip_strategy"`
|
||||
DNS []NodeDNS `json:"dns"`
|
||||
Block []string `json:"block"`
|
||||
Outbound []NodeOutbound `json:"outbound"`
|
||||
Protocols []Protocol `json:"protocols"`
|
||||
Total int64 `json:"total"`
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
126
apis/types.api
126
apis/types.api
@ -152,27 +152,27 @@ type (
|
||||
EnableResetPasswordVerify bool `json:"enable_reset_password_verify"`
|
||||
}
|
||||
NodeConfig {
|
||||
NodeSecret string `json:"node_secret"`
|
||||
NodePullInterval int64 `json:"node_pull_interval"`
|
||||
NodePushInterval int64 `json:"node_push_interval"`
|
||||
TrafficReportThreshold int64 `json:"traffic_report_threshold"`
|
||||
IPStrategy string `json:"ip_strategy"`
|
||||
DNS []NodeDNS `json:"dns"`
|
||||
Block []string `json:"block"`
|
||||
Outbound []NodeOutbound `json:"outbound"`
|
||||
NodeSecret string `json:"node_secret"`
|
||||
NodePullInterval int64 `json:"node_pull_interval"`
|
||||
NodePushInterval int64 `json:"node_push_interval"`
|
||||
TrafficReportThreshold int64 `json:"traffic_report_threshold"`
|
||||
IPStrategy string `json:"ip_strategy"`
|
||||
DNS []NodeDNS `json:"dns"`
|
||||
Block []string `json:"block"`
|
||||
Outbound []NodeOutbound `json:"outbound"`
|
||||
}
|
||||
NodeDNS {
|
||||
Proto string `json:"proto"`
|
||||
Address string `json:"address"`
|
||||
Proto string `json:"proto"`
|
||||
Address string `json:"address"`
|
||||
Domains []string `json:"domains"`
|
||||
}
|
||||
NodeOutbound {
|
||||
Name string `json:"name"`
|
||||
Protocol string `json:"protocol"`
|
||||
Address string `json:"address"`
|
||||
Port int64 `json:"port"`
|
||||
Password string `json:"password"`
|
||||
Rules []string `json:"rules"`
|
||||
Name string `json:"name"`
|
||||
Protocol string `json:"protocol"`
|
||||
Address string `json:"address"`
|
||||
Port int64 `json:"port"`
|
||||
Password string `json:"password"`
|
||||
Rules []string `json:"rules"`
|
||||
}
|
||||
InviteConfig {
|
||||
ForcedInvite bool `json:"forced_invite"`
|
||||
@ -788,53 +788,53 @@ type (
|
||||
Timestamp int64 `json:"timestamp"`
|
||||
}
|
||||
Protocol {
|
||||
Type string `json:"type"`
|
||||
Port uint16 `json:"port"`
|
||||
Enable bool `json:"enable"`
|
||||
Security string `json:"security,omitempty"`
|
||||
SNI string `json:"sni,omitempty"`
|
||||
AllowInsecure bool `json:"allow_insecure,omitempty"`
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
RealityServerAddr string `json:"reality_server_addr,omitempty"`
|
||||
RealityServerPort int `json:"reality_server_port,omitempty"`
|
||||
RealityPrivateKey string `json:"reality_private_key,omitempty"`
|
||||
RealityPublicKey string `json:"reality_public_key,omitempty"`
|
||||
RealityShortId string `json:"reality_short_id,omitempty"`
|
||||
Transport string `json:"transport,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
ServiceName string `json:"service_name,omitempty"`
|
||||
Cipher string `json:"cipher,omitempty"`
|
||||
ServerKey string `json:"server_key,omitempty"`
|
||||
Flow string `json:"flow,omitempty"`
|
||||
HopPorts string `json:"hop_ports,omitempty"`
|
||||
HopInterval int `json:"hop_interval,omitempty"`
|
||||
ObfsPassword string `json:"obfs_password,omitempty"`
|
||||
DisableSNI bool `json:"disable_sni,omitempty"`
|
||||
ReduceRtt bool `json:"reduce_rtt,omitempty"`
|
||||
UDPRelayMode string `json:"udp_relay_mode,omitempty"`
|
||||
CongestionController string `json:"congestion_controller,omitempty"`
|
||||
Multiplex string `json:"multiplex,omitempty"` // mux, eg: off/low/medium/high
|
||||
PaddingScheme string `json:"padding_scheme,omitempty"` // padding scheme
|
||||
UpMbps int `json:"up_mbps,omitempty"` // upload speed limit
|
||||
DownMbps int `json:"down_mbps,omitempty"` // download speed limit
|
||||
Obfs string `json:"obfs,omitempty"` // obfs, 'none', 'http', 'tls'
|
||||
ObfsHost string `json:"obfs_host,omitempty"` // obfs host
|
||||
ObfsPath string `json:"obfs_path,omitempty"` // obfs path
|
||||
XhttpMode string `json:"xhttp_mode,omitempty"` // xhttp mode
|
||||
XhttpExtra string `json:"xhttp_extra,omitempty"` // xhttp extra path
|
||||
Encryption string `json:"encryption,omitempty"` // encryption,'none', 'mlkem768x25519plus'
|
||||
EncryptionMode string `json:"encryption_mode,omitempty"` // encryption mode,'native', 'xorpub', 'random'
|
||||
EncryptionRtt string `json:"encryption_rtt,omitempty"` // encryption rtt,'0rtt', '1rtt'
|
||||
EncryptionTicket string `json:"encryption_ticket,omitempty"` // encryption ticket
|
||||
EncryptionServerPadding string `json:"encryption_server_padding,omitempty"` // encryption server padding
|
||||
EncryptionPrivateKey string `json:"encryption_private_key,omitempty"` // encryption private key
|
||||
EncryptionClientPadding string `json:"encryption_client_padding,omitempty"` // encryption client padding
|
||||
EncryptionPassword string `json:"encryption_password,omitempty"` // encryption password
|
||||
Ratio float64 `json:"ratio,omitempty"` // Traffic ratio, default is 1
|
||||
CertMode string `json:"cert_mode,omitempty"` // Certificate mode, `none`|`http`|`dns`|`self`
|
||||
CertDNSProvider string `json:"cert_dns_provider,omitempty"` // DNS provider for certificate
|
||||
CertDNSEnv string `json:"cert_dns_env,omitempty"` // Environment for DNS provider
|
||||
Type string `json:"type"`
|
||||
Port uint16 `json:"port"`
|
||||
Enable bool `json:"enable"`
|
||||
Security string `json:"security,omitempty"`
|
||||
SNI string `json:"sni,omitempty"`
|
||||
AllowInsecure bool `json:"allow_insecure,omitempty"`
|
||||
Fingerprint string `json:"fingerprint,omitempty"`
|
||||
RealityServerAddr string `json:"reality_server_addr,omitempty"`
|
||||
RealityServerPort int `json:"reality_server_port,omitempty"`
|
||||
RealityPrivateKey string `json:"reality_private_key,omitempty"`
|
||||
RealityPublicKey string `json:"reality_public_key,omitempty"`
|
||||
RealityShortId string `json:"reality_short_id,omitempty"`
|
||||
Transport string `json:"transport,omitempty"`
|
||||
Host string `json:"host,omitempty"`
|
||||
Path string `json:"path,omitempty"`
|
||||
ServiceName string `json:"service_name,omitempty"`
|
||||
Cipher string `json:"cipher,omitempty"`
|
||||
ServerKey string `json:"server_key,omitempty"`
|
||||
Flow string `json:"flow,omitempty"`
|
||||
HopPorts string `json:"hop_ports,omitempty"`
|
||||
HopInterval int `json:"hop_interval,omitempty"`
|
||||
ObfsPassword string `json:"obfs_password,omitempty"`
|
||||
DisableSNI bool `json:"disable_sni,omitempty"`
|
||||
ReduceRtt bool `json:"reduce_rtt,omitempty"`
|
||||
UDPRelayMode string `json:"udp_relay_mode,omitempty"`
|
||||
CongestionController string `json:"congestion_controller,omitempty"`
|
||||
Multiplex string `json:"multiplex,omitempty"` // mux, eg: off/low/medium/high
|
||||
PaddingScheme string `json:"padding_scheme,omitempty"` // padding scheme
|
||||
UpMbps int `json:"up_mbps,omitempty"` // upload speed limit
|
||||
DownMbps int `json:"down_mbps,omitempty"` // download speed limit
|
||||
Obfs string `json:"obfs,omitempty"` // obfs, 'none', 'http', 'tls'
|
||||
ObfsHost string `json:"obfs_host,omitempty"` // obfs host
|
||||
ObfsPath string `json:"obfs_path,omitempty"` // obfs path
|
||||
XhttpMode string `json:"xhttp_mode,omitempty"` // xhttp mode
|
||||
XhttpExtra string `json:"xhttp_extra,omitempty"` // xhttp extra path
|
||||
Encryption string `json:"encryption,omitempty"` // encryption,'none', 'mlkem768x25519plus'
|
||||
EncryptionMode string `json:"encryption_mode,omitempty"` // encryption mode,'native', 'xorpub', 'random'
|
||||
EncryptionRtt string `json:"encryption_rtt,omitempty"` // encryption rtt,'0rtt', '1rtt'
|
||||
EncryptionTicket string `json:"encryption_ticket,omitempty"` // encryption ticket
|
||||
EncryptionServerPadding string `json:"encryption_server_padding,omitempty"` // encryption server padding
|
||||
EncryptionPrivateKey string `json:"encryption_private_key,omitempty"` // encryption private key
|
||||
EncryptionClientPadding string `json:"encryption_client_padding,omitempty"` // encryption client padding
|
||||
EncryptionPassword string `json:"encryption_password,omitempty"` // encryption password
|
||||
Ratio float64 `json:"ratio,omitempty"` // Traffic ratio, default is 1
|
||||
CertMode string `json:"cert_mode,omitempty"` // Certificate mode, `none`|`http`|`dns`|`self`
|
||||
CertDNSProvider string `json:"cert_dns_provider,omitempty"` // DNS provider for certificate
|
||||
CertDNSEnv string `json:"cert_dns_env,omitempty"` // Environment for DNS provider
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@ -34,7 +34,6 @@ func (l *CreateServerLogic) CreateServer(req *types.CreateServerRequest) error {
|
||||
Name: req.Name,
|
||||
Country: req.Country,
|
||||
City: req.City,
|
||||
Ratio: req.Ratio,
|
||||
Address: req.Address,
|
||||
Sort: req.Sort,
|
||||
Protocols: "",
|
||||
|
||||
@ -38,7 +38,6 @@ func (l *UpdateServerLogic) UpdateServer(req *types.UpdateServerRequest) error {
|
||||
data.Name = req.Name
|
||||
data.Country = req.Country
|
||||
data.City = req.City
|
||||
data.Ratio = req.Ratio
|
||||
// only update address when it's different
|
||||
if req.Address != data.Address {
|
||||
// query server ip location
|
||||
|
||||
@ -359,7 +359,6 @@ type CreateServerRequest struct {
|
||||
Name string `json:"name"`
|
||||
Country string `json:"country,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Ratio float32 `json:"ratio"`
|
||||
Address string `json:"address"`
|
||||
Sort int `json:"sort,omitempty"`
|
||||
Protocols []Protocol `json:"protocols"`
|
||||
@ -1812,7 +1811,6 @@ type Server struct {
|
||||
Name string `json:"name"`
|
||||
Country string `json:"country"`
|
||||
City string `json:"city"`
|
||||
Ratio float32 `json:"ratio"`
|
||||
Address string `json:"address"`
|
||||
Sort int `json:"sort"`
|
||||
Protocols []Protocol `json:"protocols"`
|
||||
@ -2319,7 +2317,6 @@ type UpdateServerRequest struct {
|
||||
Name string `json:"name"`
|
||||
Country string `json:"country,omitempty"`
|
||||
City string `json:"city,omitempty"`
|
||||
Ratio float32 `json:"ratio"`
|
||||
Address string `json:"address"`
|
||||
Sort int `json:"sort,omitempty"`
|
||||
Protocols []Protocol `json:"protocols"`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user