Add OpenVPN, TrustTunnel, Sudoku, inbound managers. Fixes

This commit is contained in:
Shtorm
2026-06-04 01:47:50 +03:00
parent 9b3da79c32
commit 195a33379d
164 changed files with 16665 additions and 1332 deletions

View File

@@ -6,6 +6,6 @@ type ManagerServiceDatabase struct {
}
type ManagerServiceOptions struct {
Inbounds []string `json:"inbounds"`
Inbounds []string `json:"inbounds"`
Database ManagerServiceDatabase `json:"database"`
}

View File

@@ -5,6 +5,7 @@ import (
)
type MASQUEOutboundOptions struct {
DialerOptions
UseHTTP2 bool `json:"use_http2,omitempty"`
UseIPv6 bool `json:"use_ipv6,omitempty"`
Profile CloudflareProfile `json:"profile,omitempty"`
@@ -12,8 +13,7 @@ type MASQUEOutboundOptions struct {
UDPKeepalivePeriod badoption.Duration `json:"udp_keepalive_period,omitempty"`
UDPInitialPacketSize uint16 `json:"udp_initial_packet_size,omitempty"`
ReconnectDelay badoption.Duration `json:"reconnect_delay,omitempty"`
MASQUEOutboundTLSOptions
DialerOptions
MASQUEOutboundTLSOptionsContainer
}
type MASQUEOutboundTLSOptions struct {
@@ -28,5 +28,5 @@ type MASQUEOutboundTLSOptions struct {
}
type MASQUEOutboundTLSOptionsContainer struct {
TLS *OutboundTLSOptions `json:"tls,omitempty"`
TLS *MASQUEOutboundTLSOptions `json:"tls,omitempty"`
}

View File

@@ -1,11 +1,11 @@
package option
type NodeServiceOptions struct {
UUID string
Inbounds []string `json:"inbounds"`
ConnectionLimiters []string `json:"connection_limiters"`
BandwidthLimiters []string `json:"bandwidth_limiters"`
TrafficLimiters []string `json:"traffic_limiters"`
RateLimiters []string `json:"rate_limiters"`
Manager string `json:"manager"`
UUID string `json:"uuid"`
Inbounds []string `json:"inbounds"`
ConnectionLimiters []string `json:"connection_limiters"`
BandwidthLimiters []string `json:"bandwidth_limiters"`
TrafficLimiters []string `json:"traffic_limiters"`
RateLimiters []string `json:"rate_limiters"`
Manager string `json:"manager"`
}

View File

@@ -5,6 +5,7 @@ import (
E "github.com/sagernet/sing/common/exceptions"
"github.com/sagernet/sing/common/json"
"github.com/sagernet/sing/common/json/badjson"
"github.com/sagernet/sing/common/json/badoption"
)
type _NodeManagerAPIOptions struct {
@@ -57,8 +58,10 @@ func (o *NodeManagerAPIOptions) UnmarshalJSON(bytes []byte) error {
type NodeManagerAPIServerOptions struct {
ListenOptions
InboundTLSOptionsContainer
Manager string `json:"manager"`
APIKey string `json:"api_key"`
Manager string `json:"manager"`
APIKey string `json:"api_key"`
KeepAlive badoption.Duration `json:"keep_alive,omitempty"`
KeepAliveTimeout badoption.Duration `json:"keep_alive_timeout,omitempty"`
}
type NodeManagerAPIClientOptions struct {

40
option/openvpn.go Normal file
View File

@@ -0,0 +1,40 @@
package option
import "github.com/sagernet/sing/common/json/badoption"
type OpenVPNOutboundOptions struct {
DialerOptions
Servers []ServerOptions `json:"servers"`
Proto string `json:"proto,omitempty"`
Cipher string `json:"cipher,omitempty"`
Auth string `json:"auth,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
TLSCrypt string `json:"tls_crypt,omitempty"`
TLSCryptPath string `json:"tls_crypt_path,omitempty"`
TLSCryptV2 bool `json:"tls_crypt_v2,omitempty"`
TLSAuth string `json:"tls_auth,omitempty"`
TLSAuthPath string `json:"tls_auth_path,omitempty"`
KeyDirection int `json:"key_direction,omitempty"`
ReconnectDelay badoption.Duration `json:"reconnect_delay,omitempty"`
PingInterval badoption.Duration `json:"ping_interval,omitempty"`
OpenVPNOutboundTLSOptionsContainer
}
type OpenVPNTLSOptions struct {
Certificate string `json:"certificate,omitempty"`
CertificatePath string `json:"certificate_path,omitempty"`
Key string `json:"key,omitempty"`
KeyPath string `json:"key_path,omitempty"`
CA string `json:"ca,omitempty"`
CAPath string `json:"ca_path,omitempty"`
CipherSuites badoption.Listable[string] `json:"cipher_suites,omitempty"`
VerifyX509Name string `json:"verify_x509_name,omitempty"`
VerifyX509NameMode string `json:"verify_x509_name_mode,omitempty"`
KernelTx bool `json:"kernel_tx,omitempty"`
KernelRx bool `json:"kernel_rx,omitempty"`
}
type OpenVPNOutboundTLSOptionsContainer struct {
TLS *OpenVPNTLSOptions `json:"tls,omitempty"`
}

View File

@@ -47,8 +47,9 @@ func (h *Provider) UnmarshalJSONContext(ctx context.Context, content []byte) err
}
type ProviderLocalOptions struct {
Path string `json:"path"`
HealthCheck ProviderHealthCheckOptions `json:"health_check,omitempty"`
Path string `json:"path"`
RemoveEmojis bool `json:"remove_emojis,omitempty"`
HealthCheck ProviderHealthCheckOptions `json:"health_check,omitempty"`
}
type ProviderRemoteOptions struct {
@@ -57,14 +58,16 @@ type ProviderRemoteOptions struct {
DownloadDetour string `json:"download_detour,omitempty"`
UpdateInterval badoption.Duration `json:"update_interval,omitempty"`
Exclude *badoption.Regexp `json:"exclude,omitempty"`
Include *badoption.Regexp `json:"include,omitempty"`
HealthCheck ProviderHealthCheckOptions `json:"health_check,omitempty"`
Exclude *badoption.Regexp `json:"exclude,omitempty"`
Include *badoption.Regexp `json:"include,omitempty"`
RemoveEmojis bool `json:"remove_emojis,omitempty"`
HealthCheck ProviderHealthCheckOptions `json:"health_check,omitempty"`
}
type ProviderInlineOptions struct {
Outbounds []Outbound `json:"outbounds,omitempty"`
HealthCheck ProviderHealthCheckOptions `json:"health_check,omitempty"`
Outbounds []Outbound `json:"outbounds,omitempty"`
RemoveEmojis bool `json:"remove_emojis,omitempty"`
HealthCheck ProviderHealthCheckOptions `json:"health_check,omitempty"`
}
type ProviderHealthCheckOptions struct {

54
option/sudoku.go Normal file
View File

@@ -0,0 +1,54 @@
package option
import "github.com/sagernet/sing/common/json/badoption"
type SudokuOutboundOptions struct {
DialerOptions
ServerOptions
Key string `json:"key"`
AEADMethod string `json:"aead_method,omitempty"`
PaddingMin *int `json:"padding_min,omitempty"`
PaddingMax *int `json:"padding_max,omitempty"`
TableType string `json:"table_type,omitempty"`
EnablePureDownlink *bool `json:"enable_pure_downlink,omitempty"`
CustomTable string `json:"custom_table,omitempty"`
CustomTables []string `json:"custom_tables,omitempty"`
HTTPMask *SudokuHTTPMask `json:"http_mask,omitempty"`
}
type SudokuHTTPMask struct {
Enabled bool `json:"enabled,omitempty"`
Mode string `json:"mode,omitempty"`
Host string `json:"host,omitempty"`
PathRoot string `json:"path_root,omitempty"`
Multiplex string `json:"multiplex,omitempty"`
TLS *SudokuOutboundTLSOptions `json:"tls,omitempty"`
}
type SudokuInboundOptions struct {
ListenOptions
Key string `json:"key"`
AEADMethod string `json:"aead_method,omitempty"`
PaddingMin *int `json:"padding_min,omitempty"`
PaddingMax *int `json:"padding_max,omitempty"`
TableType string `json:"table_type,omitempty"`
HandshakeTimeout *int `json:"handshake_timeout,omitempty"`
EnablePureDownlink *bool `json:"enable_pure_downlink,omitempty"`
CustomTable string `json:"custom_table,omitempty"`
CustomTables []string `json:"custom_tables,omitempty"`
DisableHTTPMask bool `json:"disable_http_mask,omitempty"`
HTTPMaskMode string `json:"http_mask_mode,omitempty"`
PathRoot string `json:"path_root,omitempty"`
Fallback string `json:"fallback,omitempty"`
}
type SudokuOutboundTLSOptions struct {
Enabled bool `json:"enabled,omitempty"`
Fragment bool `json:"fragment,omitempty"`
FragmentFallbackDelay badoption.Duration `json:"fragment_fallback_delay,omitempty"`
RecordFragment bool `json:"record_fragment,omitempty"`
KernelTx bool `json:"kernel_tx,omitempty"`
KernelRx bool `json:"kernel_rx,omitempty"`
}

38
option/trusttunnel.go Normal file
View File

@@ -0,0 +1,38 @@
package option
type TrustTunnelInboundOptions struct {
ListenOptions
InboundTLSOptionsContainer
Users []TrustTunnelUser `json:"users,omitempty"`
Network NetworkList `json:"network,omitempty"`
CongestionController string `json:"congestion_controller,omitempty"`
BBRProfile string `json:"bbr_profile,omitempty"`
CWND int `json:"cwnd,omitempty"`
}
type TrustTunnelUser struct {
Name string `json:"name,omitempty"`
Password string `json:"password,omitempty"`
}
type TrustTunnelMultiplexOptions struct {
Enabled bool `json:"enabled,omitempty"`
MaxConnections int `json:"max_connections,omitempty"`
MinStreams int `json:"min_streams,omitempty"`
MaxStreams int `json:"max_streams,omitempty"`
}
type TrustTunnelOutboundOptions struct {
DialerOptions
ServerOptions
OutboundTLSOptionsContainer
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
Network NetworkList `json:"network,omitempty"`
HealthCheck bool `json:"health_check,omitempty"`
QUIC bool `json:"quic,omitempty"`
CongestionController string `json:"congestion_controller,omitempty"`
BBRProfile string `json:"bbr_profile,omitempty"`
CWND int `json:"cwnd,omitempty"`
Multiplex *TrustTunnelMultiplexOptions `json:"multiplex,omitempty"`
}