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