mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-27 11:01:27 +00:00
Revert: move common.go to common
This commit is contained in:
parent
4eb3acb4dd
commit
58bca70dfb
|
@ -1,4 +1,4 @@
|
|||
package common
|
||||
package conf
|
||||
|
||||
import (
|
||||
"encoding/json"
|
|
@ -1,9 +0,0 @@
|
|||
package common
|
||||
|
||||
import "github.com/xtls/xray-core/common/errors"
|
||||
|
||||
type errPathObjHolder struct{}
|
||||
|
||||
func newError(values ...interface{}) *errors.Error {
|
||||
return errors.New(values...).WithPathObj(errPathObjHolder{})
|
||||
}
|
|
@ -1,7 +1,8 @@
|
|||
package common_test
|
||||
package conf_test
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/xtls/xray-core/infra/conf"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
|
@ -11,12 +12,11 @@ import (
|
|||
"github.com/xtls/xray-core/common"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
. "github.com/xtls/xray-core/infra/conf/common"
|
||||
)
|
||||
|
||||
func TestStringListUnmarshalError(t *testing.T) {
|
||||
rawJSON := `1234`
|
||||
list := new(StringList)
|
||||
list := new(conf.StringList)
|
||||
err := json.Unmarshal([]byte(rawJSON), list)
|
||||
if err == nil {
|
||||
t.Error("expected error, but got nil")
|
||||
|
@ -25,7 +25,7 @@ func TestStringListUnmarshalError(t *testing.T) {
|
|||
|
||||
func TestStringListLen(t *testing.T) {
|
||||
rawJSON := `"a, b, c, d"`
|
||||
var list StringList
|
||||
var list conf.StringList
|
||||
err := json.Unmarshal([]byte(rawJSON), &list)
|
||||
common.Must(err)
|
||||
if r := cmp.Diff([]string(list), []string{"a", " b", " c", " d"}); r != "" {
|
||||
|
@ -35,7 +35,7 @@ func TestStringListLen(t *testing.T) {
|
|||
|
||||
func TestIPParsing(t *testing.T) {
|
||||
rawJSON := "\"8.8.8.8\""
|
||||
var address Address
|
||||
var address conf.Address
|
||||
err := json.Unmarshal([]byte(rawJSON), &address)
|
||||
common.Must(err)
|
||||
if r := cmp.Diff(address.IP(), net.IP{8, 8, 8, 8}); r != "" {
|
||||
|
@ -45,7 +45,7 @@ func TestIPParsing(t *testing.T) {
|
|||
|
||||
func TestDomainParsing(t *testing.T) {
|
||||
rawJSON := "\"example.com\""
|
||||
var address Address
|
||||
var address conf.Address
|
||||
common.Must(json.Unmarshal([]byte(rawJSON), &address))
|
||||
if address.Domain() != "example.com" {
|
||||
t.Error("domain: ", address.Domain())
|
||||
|
@ -55,7 +55,7 @@ func TestDomainParsing(t *testing.T) {
|
|||
func TestURLParsing(t *testing.T) {
|
||||
{
|
||||
rawJSON := "\"https://dns.google/dns-query\""
|
||||
var address Address
|
||||
var address conf.Address
|
||||
common.Must(json.Unmarshal([]byte(rawJSON), &address))
|
||||
if address.Domain() != "https://dns.google/dns-query" {
|
||||
t.Error("URL: ", address.Domain())
|
||||
|
@ -63,7 +63,7 @@ func TestURLParsing(t *testing.T) {
|
|||
}
|
||||
{
|
||||
rawJSON := "\"https+local://dns.google/dns-query\""
|
||||
var address Address
|
||||
var address conf.Address
|
||||
common.Must(json.Unmarshal([]byte(rawJSON), &address))
|
||||
if address.Domain() != "https+local://dns.google/dns-query" {
|
||||
t.Error("URL: ", address.Domain())
|
||||
|
@ -73,7 +73,7 @@ func TestURLParsing(t *testing.T) {
|
|||
|
||||
func TestInvalidAddressJson(t *testing.T) {
|
||||
rawJSON := "1234"
|
||||
var address Address
|
||||
var address conf.Address
|
||||
err := json.Unmarshal([]byte(rawJSON), &address)
|
||||
if err == nil {
|
||||
t.Error("nil error")
|
||||
|
@ -81,7 +81,7 @@ func TestInvalidAddressJson(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStringNetwork(t *testing.T) {
|
||||
var network Network
|
||||
var network conf.Network
|
||||
common.Must(json.Unmarshal([]byte(`"tcp"`), &network))
|
||||
if v := network.Build(); v != net.Network_TCP {
|
||||
t.Error("network: ", v)
|
||||
|
@ -89,7 +89,7 @@ func TestStringNetwork(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestArrayNetworkList(t *testing.T) {
|
||||
var list NetworkList
|
||||
var list conf.NetworkList
|
||||
common.Must(json.Unmarshal([]byte("[\"Tcp\"]"), &list))
|
||||
|
||||
nlist := list.Build()
|
||||
|
@ -102,7 +102,7 @@ func TestArrayNetworkList(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStringNetworkList(t *testing.T) {
|
||||
var list NetworkList
|
||||
var list conf.NetworkList
|
||||
common.Must(json.Unmarshal([]byte("\"TCP, ip\""), &list))
|
||||
|
||||
nlist := list.Build()
|
||||
|
@ -115,7 +115,7 @@ func TestStringNetworkList(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInvalidNetworkJson(t *testing.T) {
|
||||
var list NetworkList
|
||||
var list conf.NetworkList
|
||||
err := json.Unmarshal([]byte("0"), &list)
|
||||
if err == nil {
|
||||
t.Error("nil error")
|
||||
|
@ -123,10 +123,10 @@ func TestInvalidNetworkJson(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestIntPort(t *testing.T) {
|
||||
var portRange PortRange
|
||||
var portRange conf.PortRange
|
||||
common.Must(json.Unmarshal([]byte("1234"), &portRange))
|
||||
|
||||
if r := cmp.Diff(portRange, PortRange{
|
||||
if r := cmp.Diff(portRange, conf.PortRange{
|
||||
From: 1234, To: 1234,
|
||||
}); r != "" {
|
||||
t.Error(r)
|
||||
|
@ -134,7 +134,7 @@ func TestIntPort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOverRangeIntPort(t *testing.T) {
|
||||
var portRange PortRange
|
||||
var portRange conf.PortRange
|
||||
err := json.Unmarshal([]byte("70000"), &portRange)
|
||||
if err == nil {
|
||||
t.Error("nil error")
|
||||
|
@ -149,10 +149,10 @@ func TestOverRangeIntPort(t *testing.T) {
|
|||
func TestEnvPort(t *testing.T) {
|
||||
common.Must(os.Setenv("PORT", "1234"))
|
||||
|
||||
var portRange PortRange
|
||||
var portRange conf.PortRange
|
||||
common.Must(json.Unmarshal([]byte("\"env:PORT\""), &portRange))
|
||||
|
||||
if r := cmp.Diff(portRange, PortRange{
|
||||
if r := cmp.Diff(portRange, conf.PortRange{
|
||||
From: 1234, To: 1234,
|
||||
}); r != "" {
|
||||
t.Error(r)
|
||||
|
@ -160,10 +160,10 @@ func TestEnvPort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestSingleStringPort(t *testing.T) {
|
||||
var portRange PortRange
|
||||
var portRange conf.PortRange
|
||||
common.Must(json.Unmarshal([]byte("\"1234\""), &portRange))
|
||||
|
||||
if r := cmp.Diff(portRange, PortRange{
|
||||
if r := cmp.Diff(portRange, conf.PortRange{
|
||||
From: 1234, To: 1234,
|
||||
}); r != "" {
|
||||
t.Error(r)
|
||||
|
@ -171,10 +171,10 @@ func TestSingleStringPort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestStringPairPort(t *testing.T) {
|
||||
var portRange PortRange
|
||||
var portRange conf.PortRange
|
||||
common.Must(json.Unmarshal([]byte("\"1234-5678\""), &portRange))
|
||||
|
||||
if r := cmp.Diff(portRange, PortRange{
|
||||
if r := cmp.Diff(portRange, conf.PortRange{
|
||||
From: 1234, To: 5678,
|
||||
}); r != "" {
|
||||
t.Error(r)
|
||||
|
@ -182,7 +182,7 @@ func TestStringPairPort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestOverRangeStringPort(t *testing.T) {
|
||||
var portRange PortRange
|
||||
var portRange conf.PortRange
|
||||
err := json.Unmarshal([]byte("\"65536\""), &portRange)
|
||||
if err == nil {
|
||||
t.Error("nil error")
|
||||
|
@ -205,7 +205,7 @@ func TestOverRangeStringPort(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUserParsing(t *testing.T) {
|
||||
user := new(User)
|
||||
user := new(conf.User)
|
||||
common.Must(json.Unmarshal([]byte(`{
|
||||
"id": "96edb838-6d68-42ef-a933-25f7ac3a9d09",
|
||||
"email": "love@example.com",
|
||||
|
@ -223,7 +223,7 @@ func TestUserParsing(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestInvalidUserJson(t *testing.T) {
|
||||
user := new(User)
|
||||
user := new(conf.User)
|
||||
err := json.Unmarshal([]byte(`{"email": 1234}`), user)
|
||||
if err == nil {
|
||||
t.Error("nil error")
|
|
@ -12,28 +12,27 @@ import (
|
|||
"github.com/xtls/xray-core/common/matcher/geoip"
|
||||
"github.com/xtls/xray-core/common/matcher/geosite"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
)
|
||||
|
||||
type NameServerConfig struct {
|
||||
Address *common.Address
|
||||
Address *Address
|
||||
Port uint16
|
||||
Domains []string
|
||||
ExpectIPs common.StringList
|
||||
ExpectIPs StringList
|
||||
}
|
||||
|
||||
func (c *NameServerConfig) UnmarshalJSON(data []byte) error {
|
||||
var address common.Address
|
||||
var address Address
|
||||
if err := json.Unmarshal(data, &address); err == nil {
|
||||
c.Address = &address
|
||||
return nil
|
||||
}
|
||||
|
||||
var advanced struct {
|
||||
Address *common.Address `json:"address"`
|
||||
Address *Address `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
Domains []string `json:"domains"`
|
||||
ExpectIPs common.StringList `json:"expectIps"`
|
||||
ExpectIPs StringList `json:"expectIps"`
|
||||
}
|
||||
if err := json.Unmarshal(data, &advanced); err == nil {
|
||||
c.Address = advanced.Address
|
||||
|
@ -92,14 +91,14 @@ func (c *NameServerConfig) Build() (*dns.NameServer, error) {
|
|||
// DNSConfig is a JSON serializable object for dns.Config.
|
||||
type DNSConfig struct {
|
||||
Servers []*NameServerConfig `json:"servers"`
|
||||
Hosts map[string]*common.Address `json:"hosts"`
|
||||
ClientIP *common.Address `json:"clientIp"`
|
||||
Hosts map[string]*Address `json:"hosts"`
|
||||
ClientIP *Address `json:"clientIp"`
|
||||
Tag string `json:"tag"`
|
||||
QueryStrategy string `json:"queryStrategy"`
|
||||
DisableCache bool `json:"disableCache"`
|
||||
}
|
||||
|
||||
func getHostMapping(addr *common.Address) *dns.Config_HostMapping {
|
||||
func getHostMapping(addr *Address) *dns.Config_HostMapping {
|
||||
if addr.Family().IsIP() {
|
||||
return &dns.Config_HostMapping{
|
||||
Ip: [][]byte{[]byte(addr.IP())},
|
||||
|
|
|
@ -3,13 +3,12 @@ package conf
|
|||
import (
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/proxy/dns"
|
||||
)
|
||||
|
||||
type DNSOutboundConfig struct {
|
||||
Network common.Network `json:"network"`
|
||||
Address *common.Address `json:"address"`
|
||||
Network Network `json:"network"`
|
||||
Address *Address `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
}
|
||||
|
||||
|
|
|
@ -2,14 +2,13 @@ package conf
|
|||
|
||||
import (
|
||||
"github.com/golang/protobuf/proto"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/proxy/dokodemo"
|
||||
)
|
||||
|
||||
type DokodemoConfig struct {
|
||||
Host *common.Address `json:"address"`
|
||||
Host *Address `json:"address"`
|
||||
PortValue uint16 `json:"port"`
|
||||
NetworkList *common.NetworkList `json:"network"`
|
||||
NetworkList *NetworkList `json:"network"`
|
||||
TimeoutValue uint32 `json:"timeout"`
|
||||
Redirect bool `json:"followRedirect"`
|
||||
UserLevel uint32 `json:"userLevel"`
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/golang/protobuf/proto"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/proxy/http"
|
||||
)
|
||||
|
||||
|
@ -47,7 +46,7 @@ func (c *HTTPServerConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
|
||||
type HTTPRemoteConfig struct {
|
||||
Address *common.Address `json:"address"`
|
||||
Address *Address `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
Users []json.RawMessage `json:"users"`
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import (
|
|||
"github.com/xtls/xray-core/common/matcher/geoip"
|
||||
"github.com/xtls/xray-core/common/matcher/geosite"
|
||||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
)
|
||||
|
||||
type RouterRulesConfig struct {
|
||||
|
@ -20,7 +19,7 @@ type RouterRulesConfig struct {
|
|||
|
||||
type BalancingRule struct {
|
||||
Tag string `json:"tag"`
|
||||
Selectors common.StringList `json:"selector"`
|
||||
Selectors StringList `json:"selector"`
|
||||
}
|
||||
|
||||
func (r *BalancingRule) Build() (*router.BalancingRule, error) {
|
||||
|
@ -151,16 +150,16 @@ func ParseIP(s string) (*geoip.CIDR, error) {
|
|||
func parseFieldRule(msg json.RawMessage) (*router.RoutingRule, error) {
|
||||
type RawFieldRule struct {
|
||||
RouterRule
|
||||
Domain *common.StringList `json:"domain"`
|
||||
Domains *common.StringList `json:"domains"`
|
||||
IP *common.StringList `json:"ip"`
|
||||
Port *common.PortList `json:"port"`
|
||||
Network *common.NetworkList `json:"network"`
|
||||
SourceIP *common.StringList `json:"source"`
|
||||
SourcePort *common.PortList `json:"sourcePort"`
|
||||
User *common.StringList `json:"user"`
|
||||
InboundTag *common.StringList `json:"inboundTag"`
|
||||
Protocols *common.StringList `json:"protocol"`
|
||||
Domain *StringList `json:"domain"`
|
||||
Domains *StringList `json:"domains"`
|
||||
IP *StringList `json:"ip"`
|
||||
Port *PortList `json:"port"`
|
||||
Network *NetworkList `json:"network"`
|
||||
SourceIP *StringList `json:"source"`
|
||||
SourcePort *PortList `json:"sourcePort"`
|
||||
User *StringList `json:"user"`
|
||||
InboundTag *StringList `json:"inboundTag"`
|
||||
Protocols *StringList `json:"protocol"`
|
||||
Attributes string `json:"attrs"`
|
||||
}
|
||||
rawFieldRule := new(RawFieldRule)
|
||||
|
|
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/proxy/shadowsocks"
|
||||
)
|
||||
|
||||
|
@ -47,7 +46,7 @@ type ShadowsocksServerConfig struct {
|
|||
Level byte `json:"level"`
|
||||
Email string `json:"email"`
|
||||
Users []*ShadowsocksUserConfig `json:"clients"`
|
||||
NetworkList *common.NetworkList `json:"network"`
|
||||
NetworkList *NetworkList `json:"network"`
|
||||
}
|
||||
|
||||
func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
|
||||
|
@ -94,7 +93,7 @@ func (v *ShadowsocksServerConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
|
||||
type ShadowsocksServerTarget struct {
|
||||
Address *common.Address `json:"address"`
|
||||
Address *Address `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
Cipher string `json:"method"`
|
||||
Password string `json:"password"`
|
||||
|
|
|
@ -6,7 +6,6 @@ import (
|
|||
"github.com/golang/protobuf/proto"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/proxy/socks"
|
||||
)
|
||||
|
||||
|
@ -31,7 +30,7 @@ type SocksServerConfig struct {
|
|||
AuthMethod string `json:"auth"`
|
||||
Accounts []*SocksAccount `json:"accounts"`
|
||||
UDP bool `json:"udp"`
|
||||
Host *common.Address `json:"ip"`
|
||||
Host *Address `json:"ip"`
|
||||
Timeout uint32 `json:"timeout"`
|
||||
UserLevel uint32 `json:"userLevel"`
|
||||
}
|
||||
|
@ -66,7 +65,7 @@ func (v *SocksServerConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
|
||||
type SocksRemoteConfig struct {
|
||||
Address *common.Address `json:"address"`
|
||||
Address *Address `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
Users []json.RawMessage `json:"users"`
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
|
||||
"github.com/golang/protobuf/proto"
|
||||
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/transport/internet/headers/http"
|
||||
"github.com/xtls/xray-core/transport/internet/headers/noop"
|
||||
"github.com/xtls/xray-core/transport/internet/headers/srtp"
|
||||
|
@ -60,11 +59,11 @@ func (DTLSAuthenticator) Build() (proto.Message, error) {
|
|||
type AuthenticatorRequest struct {
|
||||
Version string `json:"version"`
|
||||
Method string `json:"method"`
|
||||
Path common.StringList `json:"path"`
|
||||
Headers map[string]*common.StringList `json:"headers"`
|
||||
Path StringList `json:"path"`
|
||||
Headers map[string]*StringList `json:"headers"`
|
||||
}
|
||||
|
||||
func sortMapKeys(m map[string]*common.StringList) []string {
|
||||
func sortMapKeys(m map[string]*StringList) []string {
|
||||
var keys []string
|
||||
for key := range m {
|
||||
keys = append(keys, key)
|
||||
|
@ -137,7 +136,7 @@ type AuthenticatorResponse struct {
|
|||
Version string `json:"version"`
|
||||
Status string `json:"status"`
|
||||
Reason string `json:"reason"`
|
||||
Headers map[string]*common.StringList `json:"headers"`
|
||||
Headers map[string]*StringList `json:"headers"`
|
||||
}
|
||||
|
||||
func (v *AuthenticatorResponse) Build() (*http.ResponseConfig, error) {
|
||||
|
|
|
@ -11,7 +11,6 @@ import (
|
|||
"github.com/xtls/xray-core/common/platform/filesystem"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
"github.com/xtls/xray-core/transport/internet/domainsocket"
|
||||
"github.com/xtls/xray-core/transport/internet/http"
|
||||
|
@ -180,7 +179,7 @@ func (c *WebSocketConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
|
||||
type HTTPConfig struct {
|
||||
Host *common.StringList `json:"host"`
|
||||
Host *StringList `json:"host"`
|
||||
Path string `json:"path"`
|
||||
}
|
||||
|
||||
|
@ -315,7 +314,7 @@ type TLSConfig struct {
|
|||
Insecure bool `json:"allowInsecure"`
|
||||
Certs []*TLSCertConfig `json:"certificates"`
|
||||
ServerName string `json:"serverName"`
|
||||
ALPN *common.StringList `json:"alpn"`
|
||||
ALPN *StringList `json:"alpn"`
|
||||
EnableSessionResumption bool `json:"enableSessionResumption"`
|
||||
DisableSystemRoot bool `json:"disableSystemRoot"`
|
||||
MinVersion string `json:"minVersion"`
|
||||
|
@ -405,7 +404,7 @@ type XTLSConfig struct {
|
|||
Insecure bool `json:"allowInsecure"`
|
||||
Certs []*XTLSCertConfig `json:"certificates"`
|
||||
ServerName string `json:"serverName"`
|
||||
ALPN *common.StringList `json:"alpn"`
|
||||
ALPN *StringList `json:"alpn"`
|
||||
EnableSessionResumption bool `json:"enableSessionResumption"`
|
||||
DisableSystemRoot bool `json:"disableSystemRoot"`
|
||||
MinVersion string `json:"minVersion"`
|
||||
|
|
|
@ -11,13 +11,12 @@ import (
|
|||
"github.com/xtls/xray-core/common/net"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/proxy/trojan"
|
||||
)
|
||||
|
||||
// TrojanServerTarget is configuration of a single trojan server
|
||||
type TrojanServerTarget struct {
|
||||
Address *common.Address `json:"address"`
|
||||
Address *Address `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
Password string `json:"password"`
|
||||
Email string `json:"email"`
|
||||
|
|
|
@ -12,7 +12,6 @@ import (
|
|||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/common/uuid"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/proxy/vless"
|
||||
"github.com/xtls/xray-core/proxy/vless/inbound"
|
||||
"github.com/xtls/xray-core/proxy/vless/outbound"
|
||||
|
@ -138,7 +137,7 @@ func (c *VLessInboundConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
|
||||
type VLessOutboundVnext struct {
|
||||
Address *common.Address `json:"address"`
|
||||
Address *Address `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
Users []json.RawMessage `json:"users"`
|
||||
}
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/common/uuid"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/proxy/vmess"
|
||||
"github.com/xtls/xray-core/proxy/vmess/inbound"
|
||||
"github.com/xtls/xray-core/proxy/vmess/outbound"
|
||||
|
@ -124,7 +123,7 @@ func (c *VMessInboundConfig) Build() (proto.Message, error) {
|
|||
}
|
||||
|
||||
type VMessOutboundTarget struct {
|
||||
Address *common.Address `json:"address"`
|
||||
Address *Address `json:"address"`
|
||||
Port uint16 `json:"port"`
|
||||
Users []json.RawMessage `json:"users"`
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@ import (
|
|||
"github.com/xtls/xray-core/common/matcher/geoip"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
core "github.com/xtls/xray-core/core"
|
||||
"github.com/xtls/xray-core/infra/conf/common"
|
||||
"github.com/xtls/xray-core/transport/internet"
|
||||
"github.com/xtls/xray-core/transport/internet/xtls"
|
||||
)
|
||||
|
@ -65,9 +64,9 @@ func toProtocolList(s []string) ([]proxyman.KnownProtocols, error) {
|
|||
|
||||
type SniffingConfig struct {
|
||||
Enabled bool `json:"enabled"`
|
||||
DestOverride *common.StringList `json:"destOverride"`
|
||||
DomainsExcluded *common.StringList `json:"domainsExcluded"`
|
||||
IPsExcluded *common.StringList `json:"ipsExcluded"`
|
||||
DestOverride *StringList `json:"destOverride"`
|
||||
DomainsExcluded *StringList `json:"domainsExcluded"`
|
||||
IPsExcluded *StringList `json:"ipsExcluded"`
|
||||
MetadataOnly bool `json:"metadataOnly"`
|
||||
}
|
||||
|
||||
|
@ -176,13 +175,13 @@ func (c *InboundDetourAllocationConfig) Build() (*proxyman.AllocationStrategy, e
|
|||
|
||||
type InboundDetourConfig struct {
|
||||
Protocol string `json:"protocol"`
|
||||
PortRange *common.PortRange `json:"port"`
|
||||
ListenOn *common.Address `json:"listen"`
|
||||
PortRange *PortRange `json:"port"`
|
||||
ListenOn *Address `json:"listen"`
|
||||
Settings *json.RawMessage `json:"settings"`
|
||||
Tag string `json:"tag"`
|
||||
Allocation *InboundDetourAllocationConfig `json:"allocate"`
|
||||
StreamSetting *StreamConfig `json:"streamSettings"`
|
||||
DomainOverride *common.StringList `json:"domainOverride"`
|
||||
DomainOverride *StringList `json:"domainOverride"`
|
||||
SniffingConfig *SniffingConfig `json:"sniffing"`
|
||||
}
|
||||
|
||||
|
@ -284,7 +283,7 @@ func (c *InboundDetourConfig) Build() (*core.InboundHandlerConfig, error) {
|
|||
|
||||
type OutboundDetourConfig struct {
|
||||
Protocol string `json:"protocol"`
|
||||
SendThrough *common.Address `json:"sendThrough"`
|
||||
SendThrough *Address `json:"sendThrough"`
|
||||
Tag string `json:"tag"`
|
||||
Settings *json.RawMessage `json:"settings"`
|
||||
StreamSetting *StreamConfig `json:"streamSettings"`
|
||||
|
@ -642,7 +641,7 @@ func (c *Config) Build() (*core.Config, error) {
|
|||
|
||||
// Backward compatibility.
|
||||
if len(inbounds) > 0 && inbounds[0].PortRange == nil && c.Port > 0 {
|
||||
inbounds[0].PortRange = &common.PortRange{
|
||||
inbounds[0].PortRange = &PortRange{
|
||||
From: uint32(c.Port),
|
||||
To: uint32(c.Port),
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue