mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-05-08 14:13:22 +00:00
Exp: Make eveything listable
This commit is contained in:
@@ -11,12 +11,13 @@ import (
|
|||||||
statsservice "github.com/xtls/xray-core/app/stats/command"
|
statsservice "github.com/xtls/xray-core/app/stats/command"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type APIConfig struct {
|
type APIConfig struct {
|
||||||
Tag string `json:"tag"`
|
Tag string `json:"tag"`
|
||||||
Listen string `json:"listen"`
|
Listen string `json:"listen"`
|
||||||
Services []string `json:"services"`
|
Services types.Listable[string] `json:"services"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *APIConfig) Build() (*commander.Config, error) {
|
func (c *APIConfig) Build() (*commander.Config, error) {
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/app/router"
|
"github.com/xtls/xray-core/app/router"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type NameServerConfig struct {
|
type NameServerConfig struct {
|
||||||
@@ -20,7 +21,7 @@ type NameServerConfig struct {
|
|||||||
ClientIP *Address `json:"clientIp"`
|
ClientIP *Address `json:"clientIp"`
|
||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
SkipFallback bool `json:"skipFallback"`
|
SkipFallback bool `json:"skipFallback"`
|
||||||
Domains []string `json:"domains"`
|
Domains types.Listable[string] `json:"domains"`
|
||||||
ExpectedIPs StringList `json:"expectedIPs"`
|
ExpectedIPs StringList `json:"expectedIPs"`
|
||||||
ExpectIPs StringList `json:"expectIPs"`
|
ExpectIPs StringList `json:"expectIPs"`
|
||||||
QueryStrategy string `json:"queryStrategy"`
|
QueryStrategy string `json:"queryStrategy"`
|
||||||
@@ -46,7 +47,7 @@ func (c *NameServerConfig) UnmarshalJSON(data []byte) error {
|
|||||||
ClientIP *Address `json:"clientIp"`
|
ClientIP *Address `json:"clientIp"`
|
||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
SkipFallback bool `json:"skipFallback"`
|
SkipFallback bool `json:"skipFallback"`
|
||||||
Domains []string `json:"domains"`
|
Domains types.Listable[string] `json:"domains"`
|
||||||
ExpectedIPs StringList `json:"expectedIPs"`
|
ExpectedIPs StringList `json:"expectedIPs"`
|
||||||
ExpectIPs StringList `json:"expectIPs"`
|
ExpectIPs StringList `json:"expectIPs"`
|
||||||
QueryStrategy string `json:"queryStrategy"`
|
QueryStrategy string `json:"queryStrategy"`
|
||||||
@@ -196,7 +197,7 @@ var typeMap = map[router.Domain_Type]dns.DomainMatchingType{
|
|||||||
|
|
||||||
// DNSConfig is a JSON serializable object for dns.Config.
|
// DNSConfig is a JSON serializable object for dns.Config.
|
||||||
type DNSConfig struct {
|
type DNSConfig struct {
|
||||||
Servers []*NameServerConfig `json:"servers"`
|
Servers types.Listable[*NameServerConfig] `json:"servers"`
|
||||||
Hosts *HostsWrapper `json:"hosts"`
|
Hosts *HostsWrapper `json:"hosts"`
|
||||||
ClientIP *Address `json:"clientIp"`
|
ClientIP *Address `json:"clientIp"`
|
||||||
Tag string `json:"tag"`
|
Tag string `json:"tag"`
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package conf
|
|||||||
import (
|
import (
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/dns"
|
"github.com/xtls/xray-core/proxy/dns"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@@ -13,7 +14,7 @@ type DNSOutboundConfig struct {
|
|||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
UserLevel uint32 `json:"userLevel"`
|
UserLevel uint32 `json:"userLevel"`
|
||||||
NonIPQuery string `json:"nonIPQuery"`
|
NonIPQuery string `json:"nonIPQuery"`
|
||||||
BlockTypes []int32 `json:"blockTypes"`
|
BlockTypes types.Listable[int32] `json:"blockTypes"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *DNSOutboundConfig) Build() (proto.Message, error) {
|
func (c *DNSOutboundConfig) Build() (proto.Message, error) {
|
||||||
|
|||||||
@@ -9,9 +9,10 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
v2net "github.com/xtls/xray-core/common/net"
|
v2net "github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/freedom"
|
"github.com/xtls/xray-core/proxy/freedom"
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
"github.com/xtls/xray-core/transport/internet"
|
"github.com/xtls/xray-core/transport/internet"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type FreedomConfig struct {
|
type FreedomConfig struct {
|
||||||
@@ -21,7 +22,7 @@ type FreedomConfig struct {
|
|||||||
UserLevel uint32 `json:"userLevel"`
|
UserLevel uint32 `json:"userLevel"`
|
||||||
Fragment *Fragment `json:"fragment"`
|
Fragment *Fragment `json:"fragment"`
|
||||||
Noise *Noise `json:"noise"`
|
Noise *Noise `json:"noise"`
|
||||||
Noises []*Noise `json:"noises"`
|
Noises types.Listable[*Noise] `json:"noises"`
|
||||||
ProxyProtocol uint32 `json:"proxyProtocol"`
|
ProxyProtocol uint32 `json:"proxyProtocol"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/http"
|
"github.com/xtls/xray-core/proxy/http"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@@ -23,7 +24,7 @@ func (v *HTTPAccount) Build() *http.Account {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type HTTPServerConfig struct {
|
type HTTPServerConfig struct {
|
||||||
Accounts []*HTTPAccount `json:"accounts"`
|
Accounts types.Listable[*HTTPAccount] `json:"accounts"`
|
||||||
Transparent bool `json:"allowTransparent"`
|
Transparent bool `json:"allowTransparent"`
|
||||||
UserLevel uint32 `json:"userLevel"`
|
UserLevel uint32 `json:"userLevel"`
|
||||||
}
|
}
|
||||||
@@ -47,7 +48,7 @@ func (c *HTTPServerConfig) Build() (proto.Message, error) {
|
|||||||
type HTTPRemoteConfig struct {
|
type HTTPRemoteConfig struct {
|
||||||
Address *Address `json:"address"`
|
Address *Address `json:"address"`
|
||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
Users []json.RawMessage `json:"users"`
|
Users types.Listable[json.RawMessage] `json:"users"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type HTTPClientConfig struct {
|
type HTTPClientConfig struct {
|
||||||
@@ -57,7 +58,7 @@ type HTTPClientConfig struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Username string `json:"user"`
|
Username string `json:"user"`
|
||||||
Password string `json:"pass"`
|
Password string `json:"pass"`
|
||||||
Servers []*HTTPRemoteConfig `json:"servers"`
|
Servers types.Listable[*HTTPRemoteConfig] `json:"servers"`
|
||||||
Headers map[string]string `json:"headers"`
|
Headers map[string]string `json:"headers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
package conf
|
package conf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
|
|
||||||
"github.com/xtls/xray-core/app/observatory"
|
"github.com/xtls/xray-core/app/observatory"
|
||||||
"github.com/xtls/xray-core/app/observatory/burst"
|
"github.com/xtls/xray-core/app/observatory/burst"
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ObservatoryConfig struct {
|
type ObservatoryConfig struct {
|
||||||
SubjectSelector []string `json:"subjectSelector"`
|
SubjectSelector types.Listable[string] `json:"subjectSelector"`
|
||||||
ProbeURL string `json:"probeURL"`
|
ProbeURL string `json:"probeURL"`
|
||||||
ProbeInterval types.Duration `json:"probeInterval"`
|
ProbeInterval types.Duration `json:"probeInterval"`
|
||||||
EnableConcurrency bool `json:"enableConcurrency"`
|
EnableConcurrency bool `json:"enableConcurrency"`
|
||||||
@@ -21,7 +20,7 @@ func (o *ObservatoryConfig) Build() (proto.Message, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BurstObservatoryConfig struct {
|
type BurstObservatoryConfig struct {
|
||||||
SubjectSelector []string `json:"subjectSelector"`
|
SubjectSelector types.Listable[string] `json:"subjectSelector"`
|
||||||
// health check settings
|
// health check settings
|
||||||
HealthCheck *healthCheckSettings `json:"pingConfig,omitempty"`
|
HealthCheck *healthCheckSettings `json:"pingConfig,omitempty"`
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package conf
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/xtls/xray-core/app/reverse"
|
"github.com/xtls/xray-core/app/reverse"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -30,8 +31,8 @@ func (c *PortalConfig) Build() (*reverse.PortalConfig, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ReverseConfig struct {
|
type ReverseConfig struct {
|
||||||
Bridges []BridgeConfig `json:"bridges"`
|
Bridges types.Listable[BridgeConfig] `json:"bridges"`
|
||||||
Portals []PortalConfig `json:"portals"`
|
Portals types.Listable[PortalConfig] `json:"portals"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ReverseConfig) Build() (proto.Message, error) {
|
func (c *ReverseConfig) Build() (proto.Message, error) {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/platform/filesystem"
|
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -74,9 +75,9 @@ func (r *BalancingRule) Build() (*router.BalancingRule, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type RouterConfig struct {
|
type RouterConfig struct {
|
||||||
RuleList []json.RawMessage `json:"rules"`
|
RuleList types.Listable[json.RawMessage] `json:"rules"`
|
||||||
DomainStrategy *string `json:"domainStrategy"`
|
DomainStrategy *string `json:"domainStrategy"`
|
||||||
Balancers []*BalancingRule `json:"balancers"`
|
Balancers types.Listable[*BalancingRule] `json:"balancers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *RouterConfig) getDomainStrategy() router.Config_DomainStrategy {
|
func (c *RouterConfig) getDomainStrategy() router.Config_DomainStrategy {
|
||||||
|
|||||||
@@ -3,11 +3,10 @@ package conf
|
|||||||
import (
|
import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"google.golang.org/protobuf/proto"
|
|
||||||
|
|
||||||
"github.com/xtls/xray-core/app/observatory/burst"
|
"github.com/xtls/xray-core/app/observatory/burst"
|
||||||
"github.com/xtls/xray-core/app/router"
|
"github.com/xtls/xray-core/app/router"
|
||||||
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -35,9 +34,9 @@ func (v *strategyEmptyConfig) Build() (proto.Message, error) {
|
|||||||
|
|
||||||
type strategyLeastLoadConfig struct {
|
type strategyLeastLoadConfig struct {
|
||||||
// weight settings
|
// weight settings
|
||||||
Costs []*router.StrategyWeight `json:"costs,omitempty"`
|
Costs types.Listable[*router.StrategyWeight] `json:"costs,omitempty"`
|
||||||
// ping rtt baselines
|
// ping rtt baselines
|
||||||
Baselines []types.Duration `json:"baselines,omitempty"`
|
Baselines types.Listable[types.Duration] `json:"baselines,omitempty"`
|
||||||
// expected nodes count to select
|
// expected nodes count to select
|
||||||
Expected int32 `json:"expected,omitempty"`
|
Expected int32 `json:"expected,omitempty"`
|
||||||
// max acceptable rtt, filter away high delay nodes. default 0
|
// max acceptable rtt, filter away high delay nodes. default 0
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/shadowsocks"
|
"github.com/xtls/xray-core/proxy/shadowsocks"
|
||||||
"github.com/xtls/xray-core/proxy/shadowsocks_2022"
|
"github.com/xtls/xray-core/proxy/shadowsocks_2022"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
@@ -44,7 +45,7 @@ type ShadowsocksServerConfig struct {
|
|||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
Level byte `json:"level"`
|
Level byte `json:"level"`
|
||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Users []*ShadowsocksUserConfig `json:"clients"`
|
Users types.Listable[*ShadowsocksUserConfig] `json:"clients"`
|
||||||
NetworkList *NetworkList `json:"network"`
|
NetworkList *NetworkList `json:"network"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,7 +179,7 @@ type ShadowsocksClientConfig struct {
|
|||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
UoT bool `json:"uot"`
|
UoT bool `json:"uot"`
|
||||||
UoTVersion int `json:"uotVersion"`
|
UoTVersion int `json:"uotVersion"`
|
||||||
Servers []*ShadowsocksServerTarget `json:"servers"`
|
Servers types.Listable[*ShadowsocksServerTarget] `json:"servers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
|
func (v *ShadowsocksClientConfig) Build() (proto.Message, error) {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/socks"
|
"github.com/xtls/xray-core/proxy/socks"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@@ -29,7 +30,7 @@ const (
|
|||||||
|
|
||||||
type SocksServerConfig struct {
|
type SocksServerConfig struct {
|
||||||
AuthMethod string `json:"auth"`
|
AuthMethod string `json:"auth"`
|
||||||
Accounts []*SocksAccount `json:"accounts"`
|
Accounts types.Listable[*SocksAccount] `json:"accounts"`
|
||||||
UDP bool `json:"udp"`
|
UDP bool `json:"udp"`
|
||||||
Host *Address `json:"ip"`
|
Host *Address `json:"ip"`
|
||||||
UserLevel uint32 `json:"userLevel"`
|
UserLevel uint32 `json:"userLevel"`
|
||||||
@@ -66,7 +67,7 @@ func (v *SocksServerConfig) Build() (proto.Message, error) {
|
|||||||
type SocksRemoteConfig struct {
|
type SocksRemoteConfig struct {
|
||||||
Address *Address `json:"address"`
|
Address *Address `json:"address"`
|
||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
Users []json.RawMessage `json:"users"`
|
Users types.Listable[json.RawMessage] `json:"users"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SocksClientConfig struct {
|
type SocksClientConfig struct {
|
||||||
@@ -76,7 +77,7 @@ type SocksClientConfig struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Username string `json:"user"`
|
Username string `json:"user"`
|
||||||
Password string `json:"pass"`
|
Password string `json:"pass"`
|
||||||
Servers []*SocksRemoteConfig `json:"servers"`
|
Servers types.Listable[*SocksRemoteConfig] `json:"servers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *SocksClientConfig) Build() (proto.Message, error) {
|
func (v *SocksClientConfig) Build() (proto.Message, error) {
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/platform/filesystem"
|
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/transport/internet"
|
"github.com/xtls/xray-core/transport/internet"
|
||||||
"github.com/xtls/xray-core/transport/internet/finalmask/salamander"
|
"github.com/xtls/xray-core/transport/internet/finalmask/salamander"
|
||||||
"github.com/xtls/xray-core/transport/internet/httpupgrade"
|
"github.com/xtls/xray-core/transport/internet/httpupgrade"
|
||||||
@@ -517,9 +518,9 @@ func readFileOrString(f string, s []string) ([]byte, error) {
|
|||||||
|
|
||||||
type TLSCertConfig struct {
|
type TLSCertConfig struct {
|
||||||
CertFile string `json:"certificateFile"`
|
CertFile string `json:"certificateFile"`
|
||||||
CertStr []string `json:"certificate"`
|
CertStr types.Listable[string] `json:"certificate"`
|
||||||
KeyFile string `json:"keyFile"`
|
KeyFile string `json:"keyFile"`
|
||||||
KeyStr []string `json:"key"`
|
KeyStr types.Listable[string] `json:"key"`
|
||||||
Usage string `json:"usage"`
|
Usage string `json:"usage"`
|
||||||
OcspStapling uint64 `json:"ocspStapling"`
|
OcspStapling uint64 `json:"ocspStapling"`
|
||||||
OneTimeLoading bool `json:"oneTimeLoading"`
|
OneTimeLoading bool `json:"oneTimeLoading"`
|
||||||
@@ -569,7 +570,7 @@ func (c *TLSCertConfig) Build() (*tls.Certificate, error) {
|
|||||||
|
|
||||||
type TLSConfig struct {
|
type TLSConfig struct {
|
||||||
AllowInsecure bool `json:"allowInsecure"`
|
AllowInsecure bool `json:"allowInsecure"`
|
||||||
Certs []*TLSCertConfig `json:"certificates"`
|
Certs types.Listable[*TLSCertConfig] `json:"certificates"`
|
||||||
ServerName string `json:"serverName"`
|
ServerName string `json:"serverName"`
|
||||||
ALPN *StringList `json:"alpn"`
|
ALPN *StringList `json:"alpn"`
|
||||||
EnableSessionResumption bool `json:"enableSessionResumption"`
|
EnableSessionResumption bool `json:"enableSessionResumption"`
|
||||||
@@ -583,7 +584,7 @@ type TLSConfig struct {
|
|||||||
MasterKeyLog string `json:"masterKeyLog"`
|
MasterKeyLog string `json:"masterKeyLog"`
|
||||||
PinnedPeerCertSha256 string `json:"pinnedPeerCertSha256"`
|
PinnedPeerCertSha256 string `json:"pinnedPeerCertSha256"`
|
||||||
VerifyPeerCertByName string `json:"verifyPeerCertByName"`
|
VerifyPeerCertByName string `json:"verifyPeerCertByName"`
|
||||||
VerifyPeerCertInNames []string `json:"verifyPeerCertInNames"`
|
VerifyPeerCertInNames types.Listable[string] `json:"verifyPeerCertInNames"`
|
||||||
ECHServerKeys string `json:"echServerKeys"`
|
ECHServerKeys string `json:"echServerKeys"`
|
||||||
ECHConfigList string `json:"echConfigList"`
|
ECHConfigList string `json:"echConfigList"`
|
||||||
ECHForceQuery string `json:"echForceQuery"`
|
ECHForceQuery string `json:"echForceQuery"`
|
||||||
@@ -699,12 +700,12 @@ type REALITYConfig struct {
|
|||||||
Dest json.RawMessage `json:"dest"`
|
Dest json.RawMessage `json:"dest"`
|
||||||
Type string `json:"type"`
|
Type string `json:"type"`
|
||||||
Xver uint64 `json:"xver"`
|
Xver uint64 `json:"xver"`
|
||||||
ServerNames []string `json:"serverNames"`
|
ServerNames types.Listable[string] `json:"serverNames"`
|
||||||
PrivateKey string `json:"privateKey"`
|
PrivateKey string `json:"privateKey"`
|
||||||
MinClientVer string `json:"minClientVer"`
|
MinClientVer string `json:"minClientVer"`
|
||||||
MaxClientVer string `json:"maxClientVer"`
|
MaxClientVer string `json:"maxClientVer"`
|
||||||
MaxTimeDiff uint64 `json:"maxTimeDiff"`
|
MaxTimeDiff uint64 `json:"maxTimeDiff"`
|
||||||
ShortIds []string `json:"shortIds"`
|
ShortIds types.Listable[string] `json:"shortIds"`
|
||||||
Mldsa65Seed string `json:"mldsa65Seed"`
|
Mldsa65Seed string `json:"mldsa65Seed"`
|
||||||
|
|
||||||
LimitFallbackUpload LimitFallback `json:"limitFallbackUpload"`
|
LimitFallbackUpload LimitFallback `json:"limitFallbackUpload"`
|
||||||
@@ -982,10 +983,10 @@ type SocketConfig struct {
|
|||||||
V6only bool `json:"v6only"`
|
V6only bool `json:"v6only"`
|
||||||
Interface string `json:"interface"`
|
Interface string `json:"interface"`
|
||||||
TcpMptcp bool `json:"tcpMptcp"`
|
TcpMptcp bool `json:"tcpMptcp"`
|
||||||
CustomSockopt []*CustomSockoptConfig `json:"customSockopt"`
|
CustomSockopt types.Listable[*CustomSockoptConfig] `json:"customSockopt"`
|
||||||
AddressPortStrategy string `json:"addressPortStrategy"`
|
AddressPortStrategy string `json:"addressPortStrategy"`
|
||||||
HappyEyeballsSettings *HappyEyeballsConfig `json:"happyEyeballs"`
|
HappyEyeballsSettings *HappyEyeballsConfig `json:"happyEyeballs"`
|
||||||
TrustedXForwardedFor []string `json:"trustedXForwardedFor"`
|
TrustedXForwardedFor types.Listable[string] `json:"trustedXForwardedFor"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable.
|
// Build implements Buildable.
|
||||||
@@ -1156,7 +1157,7 @@ type StreamConfig struct {
|
|||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
Network *TransportProtocol `json:"network"`
|
Network *TransportProtocol `json:"network"`
|
||||||
Security string `json:"security"`
|
Security string `json:"security"`
|
||||||
Udpmasks []*FinalMask `json:"udpmasks"`
|
Udpmasks types.Listable[*FinalMask] `json:"udpmasks"`
|
||||||
TLSSettings *TLSConfig `json:"tlsSettings"`
|
TLSSettings *TLSConfig `json:"tlsSettings"`
|
||||||
REALITYSettings *REALITYConfig `json:"realitySettings"`
|
REALITYSettings *REALITYConfig `json:"realitySettings"`
|
||||||
RAWSettings *TCPConfig `json:"rawSettings"`
|
RAWSettings *TCPConfig `json:"rawSettings"`
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/trojan"
|
"github.com/xtls/xray-core/proxy/trojan"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@@ -34,7 +35,7 @@ type TrojanClientConfig struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Password string `json:"password"`
|
Password string `json:"password"`
|
||||||
Flow string `json:"flow"`
|
Flow string `json:"flow"`
|
||||||
Servers []*TrojanServerTarget `json:"servers"`
|
Servers types.Listable[*TrojanServerTarget] `json:"servers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
@@ -111,8 +112,8 @@ type TrojanUserConfig struct {
|
|||||||
|
|
||||||
// TrojanServerConfig is Inbound configuration
|
// TrojanServerConfig is Inbound configuration
|
||||||
type TrojanServerConfig struct {
|
type TrojanServerConfig struct {
|
||||||
Clients []*TrojanUserConfig `json:"clients"`
|
Clients types.Listable[*TrojanUserConfig] `json:"clients"`
|
||||||
Fallbacks []*TrojanInboundFallback `json:"fallbacks"`
|
Fallbacks types.Listable[*TrojanInboundFallback] `json:"fallbacks"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package conf
|
package conf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strconv"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/app/version"
|
"github.com/xtls/xray-core/app/version"
|
||||||
"github.com/xtls/xray-core/core"
|
"github.com/xtls/xray-core/core"
|
||||||
"strconv"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type VersionConfig struct {
|
type VersionConfig struct {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
"github.com/xtls/xray-core/common/uuid"
|
"github.com/xtls/xray-core/common/uuid"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/vless"
|
"github.com/xtls/xray-core/proxy/vless"
|
||||||
"github.com/xtls/xray-core/proxy/vless/inbound"
|
"github.com/xtls/xray-core/proxy/vless/inbound"
|
||||||
"github.com/xtls/xray-core/proxy/vless/outbound"
|
"github.com/xtls/xray-core/proxy/vless/outbound"
|
||||||
@@ -30,11 +31,11 @@ type VLessInboundFallback struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type VLessInboundConfig struct {
|
type VLessInboundConfig struct {
|
||||||
Clients []json.RawMessage `json:"clients"`
|
Clients types.Listable[json.RawMessage] `json:"clients"`
|
||||||
Decryption string `json:"decryption"`
|
Decryption string `json:"decryption"`
|
||||||
Fallbacks []*VLessInboundFallback `json:"fallbacks"`
|
Fallbacks types.Listable[*VLessInboundFallback] `json:"fallbacks"`
|
||||||
Flow string `json:"flow"`
|
Flow string `json:"flow"`
|
||||||
Testseed []uint32 `json:"testseed"`
|
Testseed types.Listable[uint32] `json:"testseed"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
@@ -203,7 +204,7 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
|
|||||||
type VLessOutboundVnext struct {
|
type VLessOutboundVnext struct {
|
||||||
Address *Address `json:"address"`
|
Address *Address `json:"address"`
|
||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
Users []json.RawMessage `json:"users"`
|
Users types.Listable[json.RawMessage] `json:"users"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type VLessOutboundConfig struct {
|
type VLessOutboundConfig struct {
|
||||||
@@ -217,8 +218,8 @@ type VLessOutboundConfig struct {
|
|||||||
Encryption string `json:"encryption"`
|
Encryption string `json:"encryption"`
|
||||||
Reverse *vless.Reverse `json:"reverse"`
|
Reverse *vless.Reverse `json:"reverse"`
|
||||||
Testpre uint32 `json:"testpre"`
|
Testpre uint32 `json:"testpre"`
|
||||||
Testseed []uint32 `json:"testseed"`
|
Testseed types.Listable[uint32] `json:"testseed"`
|
||||||
Vnext []*VLessOutboundVnext `json:"vnext"`
|
Vnext types.Listable[*VLessOutboundVnext] `json:"vnext"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/protocol"
|
"github.com/xtls/xray-core/common/protocol"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
"github.com/xtls/xray-core/common/uuid"
|
"github.com/xtls/xray-core/common/uuid"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/vmess"
|
"github.com/xtls/xray-core/proxy/vmess"
|
||||||
"github.com/xtls/xray-core/proxy/vmess/inbound"
|
"github.com/xtls/xray-core/proxy/vmess/inbound"
|
||||||
"github.com/xtls/xray-core/proxy/vmess/outbound"
|
"github.com/xtls/xray-core/proxy/vmess/outbound"
|
||||||
@@ -58,7 +59,7 @@ func (c *VMessDefaultConfig) Build() *inbound.DefaultConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type VMessInboundConfig struct {
|
type VMessInboundConfig struct {
|
||||||
Users []json.RawMessage `json:"clients"`
|
Users types.Listable[json.RawMessage] `json:"clients"`
|
||||||
Defaults *VMessDefaultConfig `json:"default"`
|
Defaults *VMessDefaultConfig `json:"default"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +100,7 @@ func (c *VMessInboundConfig) Build() (proto.Message, error) {
|
|||||||
type VMessOutboundTarget struct {
|
type VMessOutboundTarget struct {
|
||||||
Address *Address `json:"address"`
|
Address *Address `json:"address"`
|
||||||
Port uint16 `json:"port"`
|
Port uint16 `json:"port"`
|
||||||
Users []json.RawMessage `json:"users"`
|
Users types.Listable[json.RawMessage] `json:"users"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type VMessOutboundConfig struct {
|
type VMessOutboundConfig struct {
|
||||||
@@ -110,7 +111,7 @@ type VMessOutboundConfig struct {
|
|||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Security string `json:"security"`
|
Security string `json:"security"`
|
||||||
Experiments string `json:"experiments"`
|
Experiments string `json:"experiments"`
|
||||||
Receivers []*VMessOutboundTarget `json:"vnext"`
|
Receivers types.Listable[*VMessOutboundTarget] `json:"vnext"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build implements Buildable
|
// Build implements Buildable
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common/errors"
|
"github.com/xtls/xray-core/common/errors"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/proxy/wireguard"
|
"github.com/xtls/xray-core/proxy/wireguard"
|
||||||
"google.golang.org/protobuf/proto"
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
@@ -15,7 +16,7 @@ type WireGuardPeerConfig struct {
|
|||||||
PreSharedKey string `json:"preSharedKey"`
|
PreSharedKey string `json:"preSharedKey"`
|
||||||
Endpoint string `json:"endpoint"`
|
Endpoint string `json:"endpoint"`
|
||||||
KeepAlive uint32 `json:"keepAlive"`
|
KeepAlive uint32 `json:"keepAlive"`
|
||||||
AllowedIPs []string `json:"allowedIPs,omitempty"`
|
AllowedIPs types.Listable[string] `json:"allowedIPs,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *WireGuardPeerConfig) Build() (proto.Message, error) {
|
func (c *WireGuardPeerConfig) Build() (proto.Message, error) {
|
||||||
@@ -53,8 +54,8 @@ type WireGuardConfig struct {
|
|||||||
|
|
||||||
NoKernelTun bool `json:"noKernelTun"`
|
NoKernelTun bool `json:"noKernelTun"`
|
||||||
SecretKey string `json:"secretKey"`
|
SecretKey string `json:"secretKey"`
|
||||||
Address []string `json:"address"`
|
Address types.Listable[string] `json:"address"`
|
||||||
Peers []*WireGuardPeerConfig `json:"peers"`
|
Peers types.Listable[*WireGuardPeerConfig] `json:"peers"`
|
||||||
MTU int32 `json:"mtu"`
|
MTU int32 `json:"mtu"`
|
||||||
NumWorkers int32 `json:"workers"`
|
NumWorkers int32 `json:"workers"`
|
||||||
Reserved []byte `json:"reserved"`
|
Reserved []byte `json:"reserved"`
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import (
|
|||||||
"github.com/xtls/xray-core/common/net"
|
"github.com/xtls/xray-core/common/net"
|
||||||
"github.com/xtls/xray-core/common/serial"
|
"github.com/xtls/xray-core/common/serial"
|
||||||
core "github.com/xtls/xray-core/core"
|
core "github.com/xtls/xray-core/core"
|
||||||
|
"github.com/xtls/xray-core/infra/conf/cfgcommon/types"
|
||||||
"github.com/xtls/xray-core/transport/internet"
|
"github.com/xtls/xray-core/transport/internet"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -341,8 +342,8 @@ type Config struct {
|
|||||||
LogConfig *LogConfig `json:"log"`
|
LogConfig *LogConfig `json:"log"`
|
||||||
RouterConfig *RouterConfig `json:"routing"`
|
RouterConfig *RouterConfig `json:"routing"`
|
||||||
DNSConfig *DNSConfig `json:"dns"`
|
DNSConfig *DNSConfig `json:"dns"`
|
||||||
InboundConfigs []InboundDetourConfig `json:"inbounds"`
|
InboundConfigs types.Listable[InboundDetourConfig] `json:"inbounds"`
|
||||||
OutboundConfigs []OutboundDetourConfig `json:"outbounds"`
|
OutboundConfigs types.Listable[OutboundDetourConfig] `json:"outbounds"`
|
||||||
Policy *PolicyConfig `json:"policy"`
|
Policy *PolicyConfig `json:"policy"`
|
||||||
API *APIConfig `json:"api"`
|
API *APIConfig `json:"api"`
|
||||||
Metrics *MetricsConfig `json:"metrics"`
|
Metrics *MetricsConfig `json:"metrics"`
|
||||||
|
|||||||
Reference in New Issue
Block a user