Fix optional listen address

This commit is contained in:
世界 2023-03-19 20:46:22 +08:00
parent 13dc70f649
commit e717852c73
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
29 changed files with 110 additions and 101 deletions

View file

@ -102,6 +102,9 @@ func readConfigAndMerge() (option.Options, error) {
if err != nil { if err != nil {
return option.Options{}, err return option.Options{}, err
} }
if len(optionsList) == 1 {
return optionsList[0].options, nil
}
var mergedOptions option.Options var mergedOptions option.Options
for _, options := range optionsList { for _, options := range optionsList {
mergedOptions, err = badjsonmerge.MergeOptions(options.options, mergedOptions) mergedOptions, err = badjsonmerge.MergeOptions(options.options, mergedOptions)

View file

@ -3,7 +3,6 @@ package inbound
import ( import (
"context" "context"
"net" "net"
"net/netip"
"github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/adapter"
"github.com/sagernet/sing-box/common/proxyproto" "github.com/sagernet/sing-box/common/proxyproto"
@ -16,7 +15,7 @@ import (
func (a *myInboundAdapter) ListenTCP() (net.Listener, error) { func (a *myInboundAdapter) ListenTCP() (net.Listener, error) {
var err error var err error
bindAddr := M.SocksaddrFrom(netip.Addr(a.listenOptions.Listen), a.listenOptions.ListenPort) bindAddr := M.SocksaddrFrom(a.listenOptions.Listen.Build(), a.listenOptions.ListenPort)
var tcpListener net.Listener var tcpListener net.Listener
if !a.listenOptions.TCPFastOpen { if !a.listenOptions.TCPFastOpen {
tcpListener, err = net.ListenTCP(M.NetworkFromNetAddr(N.NetworkTCP, bindAddr.Addr), bindAddr.TCPAddr()) tcpListener, err = net.ListenTCP(M.NetworkFromNetAddr(N.NetworkTCP, bindAddr.Addr), bindAddr.TCPAddr())

View file

@ -2,7 +2,6 @@ package inbound
import ( import (
"net" "net"
"net/netip"
"os" "os"
"time" "time"
@ -16,7 +15,7 @@ import (
) )
func (a *myInboundAdapter) ListenUDP() (net.PacketConn, error) { func (a *myInboundAdapter) ListenUDP() (net.PacketConn, error) {
bindAddr := M.SocksaddrFrom(netip.Addr(a.listenOptions.Listen), a.listenOptions.ListenPort) bindAddr := M.SocksaddrFrom(a.listenOptions.Listen.Build(), a.listenOptions.ListenPort)
var lc net.ListenConfig var lc net.ListenConfig
var udpFragment bool var udpFragment bool
if a.listenOptions.UDPFragment != nil { if a.listenOptions.UDPFragment != nil {

View file

@ -117,7 +117,7 @@ type InboundOptions struct {
} }
type ListenOptions struct { type ListenOptions struct {
Listen ListenAddress `json:"listen"` Listen *ListenAddress `json:"listen,omitempty"`
ListenPort uint16 `json:"listen_port,omitempty"` ListenPort uint16 `json:"listen_port,omitempty"`
TCPFastOpen bool `json:"tcp_fast_open,omitempty"` TCPFastOpen bool `json:"tcp_fast_open,omitempty"`
UDPFragment *bool `json:"udp_fragment,omitempty"` UDPFragment *bool `json:"udp_fragment,omitempty"`

View file

@ -16,6 +16,11 @@ import (
type ListenAddress netip.Addr type ListenAddress netip.Addr
func NewListenAddress(addr netip.Addr) *ListenAddress {
address := ListenAddress(addr)
return &address
}
func (a ListenAddress) MarshalJSON() ([]byte, error) { func (a ListenAddress) MarshalJSON() ([]byte, error) {
addr := netip.Addr(a) addr := netip.Addr(a)
if !addr.IsValid() { if !addr.IsValid() {
@ -38,8 +43,11 @@ func (a *ListenAddress) UnmarshalJSON(content []byte) error {
return nil return nil
} }
func (a ListenAddress) Build() netip.Addr { func (a *ListenAddress) Build() netip.Addr {
return (netip.Addr)(a) if a == nil {
return netip.AddrFrom4([4]byte{127, 0, 0, 1})
}
return (netip.Addr)(*a)
} }
type NetworkList string type NetworkList string

View file

@ -16,7 +16,7 @@ func TestProxyProtocol(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -25,7 +25,7 @@ func TestProxyProtocol(t *testing.T) {
Type: C.TypeDirect, Type: C.TypeDirect,
DirectOptions: option.DirectInboundOptions{ DirectOptions: option.DirectInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
ProxyProtocol: true, ProxyProtocol: true,
}, },

View file

@ -10,7 +10,7 @@ require (
github.com/docker/docker v20.10.18+incompatible github.com/docker/docker v20.10.18+incompatible
github.com/docker/go-connections v0.4.0 github.com/docker/go-connections v0.4.0
github.com/gofrs/uuid v4.4.0+incompatible github.com/gofrs/uuid v4.4.0+incompatible
github.com/sagernet/sing v0.2.1-0.20230318083058-18cd006d266e github.com/sagernet/sing v0.2.1-0.20230318094614-4bbf5f2c3046
github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9 github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9
github.com/spyzhov/ajson v0.7.1 github.com/spyzhov/ajson v0.7.1
github.com/stretchr/testify v1.8.2 github.com/stretchr/testify v1.8.2

View file

@ -126,8 +126,8 @@ github.com/sagernet/reality v0.0.0-20230312150606-35ea9af0e0b8 h1:4M3+0/kqvJuTsi
github.com/sagernet/reality v0.0.0-20230312150606-35ea9af0e0b8/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU= github.com/sagernet/reality v0.0.0-20230312150606-35ea9af0e0b8/go.mod h1:B8lp4WkQ1PwNnrVMM6KyuFR20pU8jYBD+A4EhJovEXU=
github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY= github.com/sagernet/sing v0.0.0-20220817130738-ce854cda8522/go.mod h1:QVsS5L/ZA2Q5UhQwLrn0Trw+msNd/NPGEhBKR/ioWiY=
github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk= github.com/sagernet/sing v0.1.8/go.mod h1:jt1w2u7lJQFFSGLiRrRIs5YWmx4kAPfWuOejuDW9qMk=
github.com/sagernet/sing v0.2.1-0.20230318083058-18cd006d266e h1:KDaZ0GIlpdhCVn2vf7YL2r/8E5kSZiMMeMgn5CF7eJU= github.com/sagernet/sing v0.2.1-0.20230318094614-4bbf5f2c3046 h1:/+ZWbxRvQmco9ES2qT5Eh/x/IiQRjAcUyRG/vQ4dpxc=
github.com/sagernet/sing v0.2.1-0.20230318083058-18cd006d266e/go.mod h1:9uHswk2hITw8leDbiLS/xn0t9nzBcbePxzm9PJhwdlw= github.com/sagernet/sing v0.2.1-0.20230318094614-4bbf5f2c3046/go.mod h1:9uHswk2hITw8leDbiLS/xn0t9nzBcbePxzm9PJhwdlw=
github.com/sagernet/sing-dns v0.1.4 h1:7VxgeoSCiiazDSaXXQVcvrTBxFpOePPq/4XdgnUDN+0= github.com/sagernet/sing-dns v0.1.4 h1:7VxgeoSCiiazDSaXXQVcvrTBxFpOePPq/4XdgnUDN+0=
github.com/sagernet/sing-dns v0.1.4/go.mod h1:1+6pCa48B1AI78lD+/i/dLgpw4MwfnsSpZo0Ds8wzzk= github.com/sagernet/sing-dns v0.1.4/go.mod h1:1+6pCa48B1AI78lD+/i/dLgpw4MwfnsSpZo0Ds8wzzk=
github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9 h1:qS39eA4C7x+zhEkySbASrtmb6ebdy5v0y2M6mgkmSO0= github.com/sagernet/sing-shadowsocks v0.1.2-0.20230221080503-769c01d6bba9 h1:qS39eA4C7x+zhEkySbASrtmb6ebdy5v0y2M6mgkmSO0=

View file

@ -16,7 +16,7 @@ func TestHTTPSelf(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -25,7 +25,7 @@ func TestHTTPSelf(t *testing.T) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
}, },

View file

@ -17,7 +17,7 @@ func TestHysteriaSelf(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -26,7 +26,7 @@ func TestHysteriaSelf(t *testing.T) {
Type: C.TypeHysteria, Type: C.TypeHysteria,
HysteriaOptions: option.HysteriaInboundOptions{ HysteriaOptions: option.HysteriaInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
UpMbps: 100, UpMbps: 100,
@ -90,7 +90,7 @@ func TestHysteriaInbound(t *testing.T) {
Type: C.TypeHysteria, Type: C.TypeHysteria,
HysteriaOptions: option.HysteriaInboundOptions{ HysteriaOptions: option.HysteriaInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
UpMbps: 100, UpMbps: 100,
@ -139,7 +139,7 @@ func TestHysteriaOutbound(t *testing.T) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },

View file

@ -19,7 +19,7 @@ func TestChainedInbound(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -28,7 +28,7 @@ func TestChainedInbound(t *testing.T) {
Type: C.TypeShadowsocks, Type: C.TypeShadowsocks,
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
Detour: "detour", Detour: "detour",
}, },
@ -41,7 +41,7 @@ func TestChainedInbound(t *testing.T) {
Tag: "detour", Tag: "detour",
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Method: method, Method: method,

View file

@ -41,7 +41,7 @@ func TestMuxCoolServer(t *testing.T) {
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{
@ -85,7 +85,7 @@ func TestMuxCoolClient(t *testing.T) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -117,7 +117,7 @@ func TestMuxCoolSelf(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -126,7 +126,7 @@ func TestMuxCoolSelf(t *testing.T) {
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{

View file

@ -39,7 +39,7 @@ func testShadowsocksMux(t *testing.T, protocol string) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -48,7 +48,7 @@ func testShadowsocksMux(t *testing.T, protocol string) {
Type: C.TypeShadowsocks, Type: C.TypeShadowsocks,
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Method: method, Method: method,
@ -100,7 +100,7 @@ func testVMessMux(t *testing.T, protocol string) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -109,7 +109,7 @@ func testVMessMux(t *testing.T, protocol string) {
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{

View file

@ -18,7 +18,7 @@ func TestNaiveInboundWithNginx(t *testing.T) {
Type: C.TypeNaive, Type: C.TypeNaive,
NaiveOptions: option.NaiveInboundOptions{ NaiveOptions: option.NaiveInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Users: []auth.User{ Users: []auth.User{
@ -64,7 +64,7 @@ func TestNaiveInbound(t *testing.T) {
Type: C.TypeNaive, Type: C.TypeNaive,
NaiveOptions: option.NaiveInboundOptions{ NaiveOptions: option.NaiveInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []auth.User{ Users: []auth.User{
@ -106,7 +106,7 @@ func TestNaiveHTTP3Inbound(t *testing.T) {
Type: C.TypeNaive, Type: C.TypeNaive,
NaiveOptions: option.NaiveInboundOptions{ NaiveOptions: option.NaiveInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []auth.User{ Users: []auth.User{

View file

@ -20,7 +20,7 @@ func TestVLESSVisionReality(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -29,7 +29,7 @@ func TestVLESSVisionReality(t *testing.T) {
Type: C.TypeVLESS, Type: C.TypeVLESS,
VLESSOptions: option.VLESSInboundOptions{ VLESSOptions: option.VLESSInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VLESSUser{ Users: []option.VLESSUser{
@ -61,7 +61,7 @@ func TestVLESSVisionReality(t *testing.T) {
Tag: "trojan", Tag: "trojan",
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{
@ -170,7 +170,7 @@ func testVLESSRealityTransport(t *testing.T, transport *option.V2RayTransportOpt
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -179,7 +179,7 @@ func testVLESSRealityTransport(t *testing.T, transport *option.V2RayTransportOpt
Type: C.TypeVLESS, Type: C.TypeVLESS,
VLESSOptions: option.VLESSInboundOptions{ VLESSOptions: option.VLESSInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VLESSUser{ Users: []option.VLESSUser{
@ -211,7 +211,7 @@ func testVLESSRealityTransport(t *testing.T, transport *option.V2RayTransportOpt
Tag: "trojan", Tag: "trojan",
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{

View file

@ -83,7 +83,7 @@ func testShadowsocksInboundWithShadowsocksRust(t *testing.T, method string, pass
Type: C.TypeShadowsocks, Type: C.TypeShadowsocks,
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Method: method, Method: method,
@ -108,7 +108,7 @@ func testShadowsocksOutboundWithShadowsocksRust(t *testing.T, method string, pas
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -139,7 +139,7 @@ func testShadowsocksSelf(t *testing.T, method string, password string) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -148,7 +148,7 @@ func testShadowsocksSelf(t *testing.T, method string, password string) {
Type: C.TypeShadowsocks, Type: C.TypeShadowsocks,
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Method: method, Method: method,
@ -197,7 +197,7 @@ func TestShadowsocksUoT(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -206,7 +206,7 @@ func TestShadowsocksUoT(t *testing.T) {
Type: C.TypeShadowsocks, Type: C.TypeShadowsocks,
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Method: method, Method: method,

View file

@ -22,7 +22,7 @@ func TestShadowsocksR(t *testing.T) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },

View file

@ -42,7 +42,7 @@ func testShadowTLS(t *testing.T, version int, password string, utlsEanbled bool)
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -52,7 +52,7 @@ func testShadowTLS(t *testing.T, version int, password string, utlsEanbled bool)
Tag: "in", Tag: "in",
ShadowTLSOptions: option.ShadowTLSInboundOptions{ ShadowTLSOptions: option.ShadowTLSInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
Detour: "detour", Detour: "detour",
}, },
@ -72,7 +72,7 @@ func testShadowTLS(t *testing.T, version int, password string, utlsEanbled bool)
Tag: "detour", Tag: "detour",
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Method: method, Method: method,
@ -134,7 +134,7 @@ func TestShadowTLSFallback(t *testing.T) {
Type: C.TypeShadowTLS, Type: C.TypeShadowTLS,
ShadowTLSOptions: option.ShadowTLSInboundOptions{ ShadowTLSOptions: option.ShadowTLSInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Handshake: option.ShadowTLSHandshakeOptions{ Handshake: option.ShadowTLSHandshakeOptions{
@ -180,7 +180,7 @@ func TestShadowTLSInbound(t *testing.T) {
Tag: "in", Tag: "in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -189,7 +189,7 @@ func TestShadowTLSInbound(t *testing.T) {
Type: C.TypeShadowTLS, Type: C.TypeShadowTLS,
ShadowTLSOptions: option.ShadowTLSInboundOptions{ ShadowTLSOptions: option.ShadowTLSInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
Detour: "detour", Detour: "detour",
}, },
@ -208,7 +208,7 @@ func TestShadowTLSInbound(t *testing.T) {
Tag: "detour", Tag: "detour",
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
}, },
Method: method, Method: method,
Password: password, Password: password,
@ -260,7 +260,7 @@ func TestShadowTLSOutbound(t *testing.T) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -270,7 +270,7 @@ func TestShadowTLSOutbound(t *testing.T) {
Tag: "detour", Tag: "detour",
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Method: method, Method: method,

View file

@ -37,7 +37,7 @@ func testShadowsocksPlugin(t *testing.T, name string, opts string, args string)
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },

View file

@ -19,7 +19,7 @@ func TestTCPSlowOpen(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -28,7 +28,7 @@ func TestTCPSlowOpen(t *testing.T) {
Type: C.TypeShadowsocks, Type: C.TypeShadowsocks,
ShadowsocksOptions: option.ShadowsocksInboundOptions{ ShadowsocksOptions: option.ShadowsocksInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
TCPFastOpen: true, TCPFastOpen: true,
}, },

View file

@ -17,7 +17,7 @@ func TestUTLS(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -26,7 +26,7 @@ func TestUTLS(t *testing.T) {
Type: C.TypeTrojan, Type: C.TypeTrojan,
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{

View file

@ -25,7 +25,7 @@ func TestTrojanOutbound(t *testing.T) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -61,7 +61,7 @@ func TestTrojanSelf(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -70,7 +70,7 @@ func TestTrojanSelf(t *testing.T) {
Type: C.TypeTrojan, Type: C.TypeTrojan,
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{
@ -131,7 +131,7 @@ func TestTrojanPlainSelf(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -140,7 +140,7 @@ func TestTrojanPlainSelf(t *testing.T) {
Type: C.TypeTrojan, Type: C.TypeTrojan,
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{

View file

@ -20,7 +20,7 @@ func TestV2RayAPI(t *testing.T) {
Tag: "in", Tag: "in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },

View file

@ -32,7 +32,7 @@ func testV2RayGRPCInbound(t *testing.T, forceLite bool) {
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{
@ -128,7 +128,7 @@ func testV2RayGRPCOutbound(t *testing.T, forceLite bool) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },

View file

@ -50,7 +50,7 @@ func testVMessTransportSelf(t *testing.T, server *option.V2RayTransportOptions,
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -59,7 +59,7 @@ func testVMessTransportSelf(t *testing.T, server *option.V2RayTransportOptions,
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{
@ -126,7 +126,7 @@ func testTrojanTransportSelf(t *testing.T, server *option.V2RayTransportOptions,
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -135,7 +135,7 @@ func testTrojanTransportSelf(t *testing.T, server *option.V2RayTransportOptions,
Type: C.TypeTrojan, Type: C.TypeTrojan,
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{
@ -204,7 +204,7 @@ func TestVMessQUICSelf(t *testing.T) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -213,7 +213,7 @@ func TestVMessQUICSelf(t *testing.T) {
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{
@ -279,7 +279,7 @@ func testV2RayTransportNOTLSSelf(t *testing.T, transport *option.V2RayTransportO
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -288,7 +288,7 @@ func testV2RayTransportNOTLSSelf(t *testing.T, transport *option.V2RayTransportO
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{

View file

@ -66,7 +66,7 @@ func testV2RayWebsocketInbound(t *testing.T, maxEarlyData uint32, earlyDataHeade
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{
@ -160,7 +160,7 @@ func testV2RayWebsocketOutbound(t *testing.T, maxEarlyData uint32, earlyDataHead
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },

View file

@ -42,7 +42,7 @@ func TestVLESS(t *testing.T) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -111,7 +111,7 @@ func testVLESSXrayOutbound(t *testing.T, packetEncoding string, flow string) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -121,7 +121,7 @@ func testVLESSXrayOutbound(t *testing.T, packetEncoding string, flow string) {
Tag: "trojan", Tag: "trojan",
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{
@ -219,7 +219,7 @@ func testVLESSSelf(t *testing.T, flow string) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -228,7 +228,7 @@ func testVLESSSelf(t *testing.T, flow string) {
Type: C.TypeVLESS, Type: C.TypeVLESS,
VLESSOptions: option.VLESSInboundOptions{ VLESSOptions: option.VLESSInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VLESSUser{ Users: []option.VLESSUser{
@ -294,7 +294,7 @@ func testVLESSSelfTLS(t *testing.T, flow string) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -303,7 +303,7 @@ func testVLESSSelfTLS(t *testing.T, flow string) {
Type: C.TypeVLESS, Type: C.TypeVLESS,
VLESSOptions: option.VLESSInboundOptions{ VLESSOptions: option.VLESSInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VLESSUser{ Users: []option.VLESSUser{
@ -326,7 +326,7 @@ func testVLESSSelfTLS(t *testing.T, flow string) {
Tag: "trojan", Tag: "trojan",
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{
@ -414,7 +414,7 @@ func testVLESSXrayInbound(t *testing.T, flow string) {
Type: C.TypeVLESS, Type: C.TypeVLESS,
VLESSOptions: option.VLESSInboundOptions{ VLESSOptions: option.VLESSInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VLESSUser{ Users: []option.VLESSUser{
@ -437,7 +437,7 @@ func testVLESSXrayInbound(t *testing.T, flow string) {
Tag: "trojan", Tag: "trojan",
TrojanOptions: option.TrojanInboundOptions{ TrojanOptions: option.TrojanInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherPort, ListenPort: otherPort,
}, },
Users: []option.TrojanUser{ Users: []option.TrojanUser{
@ -464,7 +464,7 @@ func testVLESSXrayInbound(t *testing.T, flow string) {
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: otherClientPort, ListenPort: otherClientPort,
}, },
}, },

View file

@ -185,7 +185,7 @@ func testVMessInboundWithV2Ray(t *testing.T, security string, alterId int, authe
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{
@ -232,7 +232,7 @@ func testVMessOutboundWithV2Ray(t *testing.T, security string, globalPadding boo
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -267,7 +267,7 @@ func testVMessSelf(t *testing.T, security string, alterId int, globalPadding boo
Tag: "mixed-in", Tag: "mixed-in",
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },
@ -276,7 +276,7 @@ func testVMessSelf(t *testing.T, security string, alterId int, globalPadding boo
Type: C.TypeVMess, Type: C.TypeVMess,
VMessOptions: option.VMessInboundOptions{ VMessOptions: option.VMessInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: serverPort, ListenPort: serverPort,
}, },
Users: []option.VMessUser{ Users: []option.VMessUser{

View file

@ -26,7 +26,7 @@ func TestWireGuard(t *testing.T) {
Type: C.TypeMixed, Type: C.TypeMixed,
MixedOptions: option.HTTPMixedInboundOptions{ MixedOptions: option.HTTPMixedInboundOptions{
ListenOptions: option.ListenOptions{ ListenOptions: option.ListenOptions{
Listen: option.ListenAddress(netip.IPv4Unspecified()), Listen: option.NewListenAddress(netip.IPv4Unspecified()),
ListenPort: clientPort, ListenPort: clientPort,
}, },
}, },