Documentation
¶
Overview ¶
Package dto is the network module's contract: the requests and responses of the admin server and node management, the node-facing server API and the edge manifest. The package keeps the name dto so that the Swagger schema names stay dto.*.
Index ¶
- type CreateNodeRequest
- type CreateServerRequest
- type DeleteNodeRequest
- type DeleteServerRequest
- type EdgeManifestProxy
- type EdgeManifestResponse
- type EdgeManifestSubscription
- type EdgeManifestTLS
- type EdgeManifestTransport
- type FilterNodeListRequest
- type FilterNodeListResponse
- type FilterServerListRequest
- type FilterServerListResponse
- type GetServerConfigRequest
- type GetServerConfigResponse
- type GetServerNodeConfigRequest
- type GetServerNodeConfigResponse
- type GetServerProtocolsRequest
- type GetServerProtocolsResponse
- type GetServerUserListRequest
- type GetServerUserListResponse
- type NetworkSortItem
- type Node
- type NodeDNS
- type NodeOutbound
- type OnlineUser
- type OnlineUsersRequest
- type Protocol
- type QueryNodeTagResponse
- type QueryServerConfigRequest
- type QueryServerConfigResponse
- type ResetSortRequest
- type Server
- type ServerBasic
- type ServerCommon
- type ServerNodeConfigOverride
- type ServerNodeConfigValues
- type ServerOnlineIP
- type ServerOnlineUser
- type ServerPushStatusRequest
- type ServerPushUserTrafficRequest
- type ServerStatus
- type ServerUser
- type ToggleNodeStatusRequest
- type UpdateNodeRequest
- type UpdateServerNodeConfigRequest
- type UpdateServerRequest
- type UserTraffic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CreateNodeRequest ¶
type CreateServerRequest ¶
type DeleteNodeRequest ¶
type DeleteNodeRequest struct {
Id int64 `json:"id"`
}
type DeleteServerRequest ¶
type DeleteServerRequest struct {
Id int64 `json:"id"`
}
type EdgeManifestProxy ¶
type EdgeManifestProxy struct {
Name string `json:"name"`
Protocol string `json:"protocol"`
Server string `json:"server"`
Port uint16 `json:"port"`
UUID string `json:"uuid,omitempty"`
Password string `json:"password,omitempty"`
Cipher string `json:"cipher,omitempty"`
Flow string `json:"flow,omitempty"`
UDP bool `json:"udp"`
TLS *EdgeManifestTLS `json:"tls,omitempty"`
Transport *EdgeManifestTransport `json:"transport,omitempty"`
Tags []string `json:"tags,omitempty"`
Sort int `json:"sort"`
}
type EdgeManifestResponse ¶
type EdgeManifestResponse struct {
SchemaVersion string `json:"schema_version"`
Revision string `json:"revision"`
GeneratedAt string `json:"generated_at"`
Subscription EdgeManifestSubscription `json:"subscription"`
Proxies []EdgeManifestProxy `json:"proxies"`
Notices []string `json:"notices"`
}
EdgeManifestResponse is deliberately independent from SubscribeResponse: it is a data contract for a trusted renderer, not a client configuration.
type EdgeManifestSubscription ¶
type EdgeManifestSubscription struct {
Name string `json:"name"`
State string `json:"state"`
ExpiresAt string `json:"expires_at,omitempty"`
TrafficLimit int64 `json:"traffic_limit"`
Upload int64 `json:"upload"`
Download int64 `json:"download"`
UpdateIntervalHours int64 `json:"update_interval_hours,omitempty"`
WebPageURL string `json:"web_page_url,omitempty"`
}
type EdgeManifestTLS ¶
type EdgeManifestTransport ¶
type FilterNodeListRequest ¶
type FilterNodeListResponse ¶
type FilterServerListRequest ¶
type GetServerConfigRequest ¶
type GetServerConfigRequest struct {
ServerCommon
}
type GetServerConfigResponse ¶
type GetServerConfigResponse struct {
Basic ServerBasic `json:"basic"`
Protocol string `json:"protocol"`
Config any `json:"config"`
}
type GetServerNodeConfigRequest ¶
type GetServerNodeConfigRequest struct {
ServerID int64 `form:"server_id" validate:"required"`
}
type GetServerNodeConfigResponse ¶
type GetServerNodeConfigResponse struct {
Global ServerNodeConfigValues `json:"global"`
Override ServerNodeConfigOverride `json:"override"`
Effective ServerNodeConfigValues `json:"effective"`
}
type GetServerProtocolsRequest ¶
type GetServerProtocolsRequest struct {
Id int64 `form:"id"`
}
type GetServerProtocolsResponse ¶
type GetServerProtocolsResponse struct {
Protocols []Protocol `json:"protocols"`
}
type GetServerUserListRequest ¶
type GetServerUserListRequest struct {
ServerCommon
}
type GetServerUserListResponse ¶
type GetServerUserListResponse struct {
Users []ServerUser `json:"users"`
}
type NetworkSortItem ¶
type Node ¶
type Node struct {
Id int64 `json:"id"`
Name string `json:"name"`
Tags []string `json:"tags"`
Port uint16 `json:"port"`
Address string `json:"address"`
ServerId int64 `json:"server_id"`
Protocol string `json:"protocol"`
Enabled *bool `json:"enabled"`
Sort int `json:"sort,omitempty"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type NodeOutbound ¶
type NodeOutbound struct {
Name string `json:"name"`
Protocol string `json:"protocol"`
Address string `json:"address"`
Port int64 `json:"port"`
User string `json:"user,omitempty"`
Password string `json:"password"`
UUID string `json:"uuid,omitempty"`
Cipher string `json:"cipher,omitempty"`
Plugin string `json:"plugin,omitempty"`
PluginOptions any `json:"plugin_opts,omitempty"`
Security string `json:"security,omitempty"`
SNI string `json:"sni,omitempty"`
ALPN []string `json:"alpn,omitempty"`
AllowInsecure bool `json:"allow_insecure,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"`
Transport string `json:"transport,omitempty"`
Host string `json:"host,omitempty"`
Path string `json:"path,omitempty"`
ServiceName string `json:"service_name,omitempty"`
XHTTPMode string `json:"xhttp_mode,omitempty"`
XHTTPExtra string `json:"xhttp_extra,omitempty"`
Flow string `json:"flow,omitempty"`
Encryption string `json:"encryption,omitempty"`
EncryptionMode string `json:"encryption_mode,omitempty"`
EncryptionRTT string `json:"encryption_rtt,omitempty"`
EncryptionTicket string `json:"encryption_ticket,omitempty"`
EncryptionPadding string `json:"encryption_client_padding,omitempty"`
EncryptionPassword string `json:"encryption_password,omitempty"`
Multiplex string `json:"multiplex,omitempty"`
UoT bool `json:"uot,omitempty"`
UoTVersion int `json:"uot_version,omitempty"`
CongestionController string `json:"congestion_controller,omitempty"`
UDPStream bool `json:"udp_stream,omitempty"`
ReduceRtt bool `json:"reduce_rtt,omitempty"`
Heartbeat int `json:"heartbeat,omitempty"`
RealityPublicKey string `json:"reality_public_key,omitempty"`
RealityShortId string `json:"reality_short_id,omitempty"`
SpiderX string `json:"spider_x,omitempty"`
Settings string `json:"settings,omitempty"`
StreamSettings string `json:"stream_settings,omitempty"`
Rules []string `json:"rules"`
}
type OnlineUser ¶
type OnlineUsersRequest ¶
type OnlineUsersRequest struct {
ServerCommon
Users []OnlineUser `json:"users"`
}
type Protocol ¶
type Protocol struct {
// Common: the protocol type, such as shadowsocks, vless, vmess, hysteria2, tuic or nowhere.
Type string `json:"type"`
// Common: the inbound listening port.
Port uint16 `json:"port"`
// Version: Snell accepts 5 or 6, TUIC 5 and Nowhere 1; 0 means the protocol's default.
Version int `json:"version,omitempty"`
// Snell only: the Snell v6 mode; other protocols leave it unset.
Mode string `json:"mode,omitempty"`
// Common: whether the inbound protocol is enabled.
Enable bool `json:"enable"`
// TLS/REALITY protocols: none, tls or reality; each protocol limits the values it accepts.
Security string `json:"security,omitempty"`
// Listening network: tcp, udp or both; Nowhere normalizes it to mix, tcp or udp, and the other protocols check it against what each supports.
Network string `json:"network,omitempty"`
// TLS protocols: the certificate domain and the TLS server name; REALITY also uses it as the server name.
SNI string `json:"sni,omitempty"`
// TLS/HTTP/QUIC protocols: the TLS ALPN list; Nowhere takes exactly one value, now/1 by default.
ALPN []string `json:"alpn,omitempty"`
// TLS client compatibility: allows skipping certificate verification; inbound configurations usually ignore it, and it is not a server certificate setting.
AllowInsecure bool `json:"allow_insecure,omitempty"`
// TLS client compatibility: the uTLS fingerprint; node inbounds currently ignore it, it is kept only for outbound and legacy configurations.
Fingerprint string `json:"fingerprint,omitempty"`
// VLESS/VMess REALITY only: the address the REALITY handshake is forwarded to.
RealityServerAddr string `json:"reality_server_addr,omitempty"`
// VLESS/VMess REALITY only: the port the REALITY handshake is forwarded to.
RealityServerPort int `json:"reality_server_port,omitempty"`
// VLESS/VMess REALITY, server side only: the server's X25519 private key.
RealityPrivateKey string `json:"reality_private_key,omitempty"`
// VLESS/VMess REALITY client information: the public key of the private key, mainly for the subscription output.
RealityPublicKey string `json:"reality_public_key,omitempty"`
// VLESS/VMess REALITY only: the short ID clients may use.
RealityShortId string `json:"reality_short_id,omitempty"`
// VLESS/VMess/Trojan transport: tcp, ws, httpupgrade, grpc or xhttp.
Transport string `json:"transport,omitempty"`
// VLESS/VMess/Trojan transport: the Host of WebSocket, HTTPUpgrade or XHTTP.
Host string `json:"host,omitempty"`
// VLESS/VMess/Trojan transport: the request path of WebSocket, HTTPUpgrade or XHTTP.
Path string `json:"path,omitempty"`
// VLESS/VMess/Trojan gRPC transport only: the gRPC service name.
ServiceName string `json:"service_name,omitempty"`
// Shadowsocks/SSR: the Shadowsocks method or the SSR cipher.
Cipher string `json:"cipher,omitempty"`
// Key-based protocols: the Shadowsocks 2022 server key, the SSR password or the Snell PSK.
ServerKey string `json:"server_key,omitempty"`
// Shadowsocks (AEAD/2022) only: the inbound plugin, such as obfs, v2ray-plugin, shadow-tls or restls.
Plugin string `json:"plugin,omitempty"`
// Shadowsocks (AEAD/2022) only: the structured options of the selected inbound plugin.
PluginOptions any `json:"plugin_opts,omitempty"`
// VLESS only: the XTLS Vision flow control; xtls-rprx-vision is currently the only valid value.
Flow string `json:"flow,omitempty"`
// Protocol-independent capability: UDP over TCP, for every protocol that supports UoT rather than one in particular.
UoT bool `json:"uot,omitempty"`
// Protocol-independent capability: the UoT version, currently 1 or 2; 0 means the default version.
UoTVersion int `json:"uot_version,omitempty"`
// Listener compatibility: whether to accept the PROXY protocol; node inbounds do not all enable it yet.
AcceptProxyProtocol bool `json:"accept_proxy_protocol,omitempty"`
// Hysteria2/TUIC-style QUIC protocols: the port hopping range; node inbounds do not enable port hopping yet.
HopPorts string `json:"hop_ports,omitempty"`
// Hysteria2/TUIC-style QUIC protocols: the port hopping interval; node inbounds do not enable port hopping yet.
HopInterval int `json:"hop_interval,omitempty"`
// Hysteria2 only: the Salamander obfuscation password, used only with obfs=salamander.
ObfsPassword string `json:"obfs_password,omitempty"`
// TLS client compatibility: disables SNI; server inbounds currently ignore it.
DisableSNI bool `json:"disable_sni,omitempty"`
// TUIC only: enables QUIC 0-RTT to save round trips on the first handshake.
ReduceRtt bool `json:"reduce_rtt,omitempty"`
// TUIC only: the connection heartbeat interval in seconds; 0 uses the node's default.
Heartbeat int `json:"heartbeat,omitempty"`
// TUIC/Hysteria compatibility: the UDP relay mode of the former implementation; node inbounds currently ignore it.
UDPRelayMode string `json:"udp_relay_mode,omitempty"`
// QUIC protocols: TUIC's congestion control field, and the legacy alias of Naive's.
CongestionController string `json:"congestion_controller,omitempty"`
// QUIC protocols: Naive's congestion control field, and the compatibility alias of TUIC's.
QUICCongestionControl string `json:"quic_congestion_control,omitempty"`
// Protocol-independent capability: the multiplexing level (off, low, medium or high), for the stream protocols that support mux.
Multiplex string `json:"multiplex,omitempty"`
// AnyTLS only: the TLS record padding scheme.
PaddingScheme string `json:"padding_scheme,omitempty"`
// Mieru only: the traffic pattern (packet length distribution) settings.
TrafficPattern string `json:"traffic_pattern,omitempty"`
// Mieru only: whether clients must send a user hint that identifies the user.
UserHintIsMandatory bool `json:"user_hint_is_mandatory,omitempty"`
// Hysteria2 only: the server's upload bandwidth in Mbps.
UpMbps int `json:"up_mbps,omitempty"`
// Hysteria2 only: the server's download bandwidth in Mbps.
DownMbps int `json:"down_mbps,omitempty"`
// Obfuscating protocols: Hysteria2's Salamander, Snell v5's obfs or SSR's obfs method.
Obfs string `json:"obfs,omitempty"`
// SSR only: the SSR protocol method, under the JSON name protocol, which is not the top-level type.
SSRProtocol string `json:"protocol,omitempty"`
// SSR only: the SSR protocol_param.
ProtocolParam string `json:"protocol_param,omitempty"`
// SSR only: the SSR obfs_param.
ObfsParam string `json:"obfs_param,omitempty"`
// Legacy obfuscation compatibility: the obfuscation Host; node inbounds currently ignore it, and Shadowsocks plugins take plugin_opts instead.
ObfsHost string `json:"obfs_host,omitempty"`
// Legacy obfuscation compatibility: the obfuscation request path; node inbounds currently ignore it, and Shadowsocks plugins take plugin_opts instead.
ObfsPath string `json:"obfs_path,omitempty"`
// VLESS/VMess/Trojan XHTTP transport only: the XHTTP mode, such as auto, packet-up or stream-up.
XhttpMode string `json:"xhttp_mode,omitempty"`
// VLESS/VMess/Trojan XHTTP transport only: the XHTTP extra path and parameters.
XhttpExtra string `json:"xhttp_extra,omitempty"`
// VLESS Encryption only: the cipher suite, such as none or mlkem768x25519plus.
Encryption string `json:"encryption,omitempty"`
// VLESS Encryption only: the key encapsulation mode, such as native, xorpub or random.
EncryptionMode string `json:"encryption_mode,omitempty"`
// VLESS Encryption only: the handshake round-trip mode, 0rtt or 1rtt.
EncryptionRtt string `json:"encryption_rtt,omitempty"`
// VLESS Encryption, server side only: the 0-RTT ticket.
EncryptionTicket string `json:"encryption_ticket,omitempty"`
// VLESS Encryption, server side only: the padding rules of the server direction.
EncryptionServerPadding string `json:"encryption_server_padding,omitempty"`
// VLESS Encryption, server side only: the ML-KEM/X25519 private key material.
EncryptionPrivateKey string `json:"encryption_private_key,omitempty"`
// VLESS Encryption client information: the padding rules of the client direction, for the subscription output.
EncryptionClientPadding string `json:"encryption_client_padding,omitempty"`
// VLESS Encryption client information: the 1-RTT (derived) authentication password, for the subscription output.
EncryptionPassword string `json:"encryption_password,omitempty"`
// Subscription clients: whether Encrypted ClientHello is enabled; left out of the configuration distributed to the nodes.
EchEnable bool `json:"ech_enable,omitempty"`
// Subscription clients: the outer ECH server name; left out of the configuration distributed to the nodes.
EchServerName string `json:"ech_server_name,omitempty"`
// Panel: the traffic billing ratio, 1 by default; not part of the protocol handshake.
Ratio float64 `json:"ratio,omitempty"`
// TLS protocols: the certificate source, file, self, http or dns; none configures no certificate.
CertMode string `json:"cert_mode,omitempty"`
// TLS protocols: the DNS provider used with cert_mode=dns.
CertDNSProvider string `json:"cert_dns_provider,omitempty"`
// TLS protocols: the environment variables (credentials) passed to the DNS provider with cert_mode=dns.
CertDNSEnv string `json:"cert_dns_env,omitempty"`
}
type QueryNodeTagResponse ¶
type QueryNodeTagResponse struct {
Tags []string `json:"tags"`
}
type QueryServerConfigResponse ¶
type QueryServerConfigResponse struct {
TrafficReportThreshold int64 `json:"traffic_report_threshold"`
PushInterval int64 `json:"push_interval"`
PullInterval int64 `json:"pull_interval"`
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"`
}
type ResetSortRequest ¶
type ResetSortRequest struct {
Sort []NetworkSortItem `json:"sort"`
}
type Server ¶
type Server struct {
Id int64 `json:"id"`
Name string `json:"name"`
Country string `json:"country"`
City string `json:"city"`
Address string `json:"address"`
Sort int `json:"sort"`
Protocols []Protocol `json:"protocols"`
LastReportedAt int64 `json:"last_reported_at"`
Status ServerStatus `json:"status"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type ServerBasic ¶
type ServerCommon ¶
type ServerNodeConfigOverride ¶
type ServerNodeConfigOverride struct {
InheritIPStrategy bool `json:"inherit_ip_strategy"`
IPStrategy string `json:"ip_strategy"`
InheritDNS bool `json:"inherit_dns"`
DNS []NodeDNS `json:"dns"`
InheritBlock bool `json:"inherit_block"`
Block []string `json:"block"`
InheritOutbound bool `json:"inherit_outbound"`
Outbound []NodeOutbound `json:"outbound"`
}
type ServerNodeConfigValues ¶
type ServerNodeConfigValues struct {
IPStrategy string `json:"ip_strategy"`
DNS []NodeDNS `json:"dns"`
Block []string `json:"block"`
Outbound []NodeOutbound `json:"outbound"`
}
type ServerOnlineIP ¶
type ServerOnlineUser ¶
type ServerPushStatusRequest ¶
type ServerPushStatusRequest struct {
ServerCommon
Cpu float64 `json:"cpu"`
Mem float64 `json:"mem"`
Disk float64 `json:"disk"`
UpdatedAt int64 `json:"updated_at"`
// CertPinSHA256 is transport metadata carried by the
// X-Node-Certificate-SHA256 request header, not part of the body.
CertPinSHA256 string `json:"-"`
}
type ServerPushUserTrafficRequest ¶
type ServerPushUserTrafficRequest struct {
ServerCommon
Traffic []UserTraffic `json:"traffic"`
}
type ServerStatus ¶
type ServerUser ¶
type ToggleNodeStatusRequest ¶
type UpdateNodeRequest ¶
type UpdateServerNodeConfigRequest ¶
type UpdateServerNodeConfigRequest struct {
ServerID int64 `json:"server_id" validate:"required"`
ServerNodeConfigOverride
}
type UpdateServerRequest ¶
type UpdateServerRequest struct {
Id int64 `json:"id"`
Name string `json:"name"`
Country string `json:"country,omitempty"`
City string `json:"city,omitempty"`
Address string `json:"address"`
Sort int `json:"sort,omitempty"`
Protocols []Protocol `json:"protocols"`
ProtocolFieldSets []map[string]struct{} `json:"-"`
}
type UserTraffic ¶
type UserTraffic struct {
SID int64 `json:"uid"`
Upload int64 `json:"upload"`
Download int64 `json:"download"`
}
UserTraffic is one node-reported usage entry: SID is the user_subscribe id GET /v1/server/user handed the node, Upload and Download the bytes since the previous report. The traffic pipeline drops (and logs) entries that are negative, exceed trafficagg.MaxReportedTraffic or name a subscription the reporting server does not serve; the rest of the report still applies.