From aff8dc73e1d7fc8751b95231ca01e81fdd23d33b Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Fri, 12 Jun 2026 10:35:35 +0800 Subject: [PATCH] chore: adjust struct name --- adapter/inbound/listen.go | 14 +++++++------- dns/server.go | 2 +- hub/executor/executor.go | 2 +- hub/route/server.go | 6 +++--- listener/anytls/server.go | 2 +- listener/http/server.go | 6 +++--- listener/hysteria2_realm/server.go | 2 +- listener/inbound/anytls.go | 2 +- listener/inbound/base.go | 8 ++++---- listener/inbound/http.go | 2 +- listener/inbound/hysteria2.go | 2 +- listener/inbound/hysteria2_realm.go | 2 +- listener/inbound/mieru.go | 2 +- listener/inbound/mixed.go | 2 +- listener/inbound/shadowsocks.go | 2 +- listener/inbound/snell.go | 2 +- listener/inbound/socks.go | 2 +- listener/inbound/sudoku.go | 2 +- listener/inbound/trojan.go | 2 +- listener/inbound/trusttunnel.go | 2 +- listener/inbound/tuic.go | 2 +- listener/inbound/tunnel.go | 2 +- listener/inbound/vless.go | 2 +- listener/inbound/vmess.go | 2 +- listener/listener.go | 8 ++++---- listener/mixed/mixed.go | 4 ++-- listener/shadowsocks/tcp.go | 2 +- listener/shadowsocks/udp.go | 2 +- listener/sing_hysteria2/server.go | 2 +- listener/sing_shadowsocks/server.go | 2 +- listener/sing_vless/server.go | 2 +- listener/sing_vmess/server.go | 2 +- listener/snell/server.go | 2 +- listener/socks/tcp.go | 4 ++-- listener/socks/udp.go | 4 ++-- listener/sudoku/server.go | 2 +- listener/trojan/server.go | 2 +- listener/trusttunnel/server.go | 2 +- listener/tuic/server.go | 2 +- listener/tunnel/tcp.go | 2 +- listener/tunnel/udp.go | 2 +- 41 files changed, 60 insertions(+), 60 deletions(-) diff --git a/adapter/inbound/listen.go b/adapter/inbound/listen.go index 43d11d6d7..b74ce2608 100644 --- a/adapter/inbound/listen.go +++ b/adapter/inbound/listen.go @@ -37,19 +37,19 @@ func MPTCP() bool { type controlFn = func(network, address string, c syscall.RawConn) error -type ListenerConfig struct { +type ListenConfig struct { routeMark int } -func NewListenerConfig() *ListenerConfig { - return &ListenerConfig{} +func NewListenConfig() *ListenConfig { + return &ListenConfig{} } -func (l *ListenerConfig) SetRouteMark(mark int) { +func (l *ListenConfig) SetRouteMark(mark int) { l.routeMark = mark } -func (l ListenerConfig) newListenConfig() *tfo.ListenConfig { +func (l ListenConfig) newListenConfig() *tfo.ListenConfig { lc := tfo.ListenConfig{DisableTFO: !Tfo()} keepalive.SetNetListenConfig(&lc.ListenConfig) mptcp.SetNetListenConfig(&lc.ListenConfig, MPTCP()) @@ -65,7 +65,7 @@ func (l ListenerConfig) newListenConfig() *tfo.ListenConfig { return &lc } -func (l ListenerConfig) Listen(ctx context.Context, network, address string) (net.Listener, error) { +func (l ListenConfig) Listen(ctx context.Context, network, address string) (net.Listener, error) { address, err := preResolve(network, address) if err != nil { return nil, err @@ -73,7 +73,7 @@ func (l ListenerConfig) Listen(ctx context.Context, network, address string) (ne return l.newListenConfig().Listen(ctx, network, address) } -func (l ListenerConfig) ListenPacket(ctx context.Context, network, address string) (net.PacketConn, error) { +func (l ListenConfig) ListenPacket(ctx context.Context, network, address string) (net.PacketConn, error) { address, err := preResolve(network, address) if err != nil { return nil, err diff --git a/dns/server.go b/dns/server.go index 32d1cd49c..06bf33bcd 100644 --- a/dns/server.go +++ b/dns/server.go @@ -43,7 +43,7 @@ func (s *Server) SetService(service resolver.Service) { s.service = service } -func ReCreateServer(addr string, lc *inbound.ListenerConfig, service resolver.Service) { +func ReCreateServer(addr string, lc *inbound.ListenConfig, service resolver.Service) { if addr == address && service != nil { server.SetService(service) return diff --git a/hub/executor/executor.go b/hub/executor/executor.go index 484f10657..b657a9532 100644 --- a/hub/executor/executor.go +++ b/hub/executor/executor.go @@ -297,7 +297,7 @@ func updateDNS(c *config.DNS, generalIPv6 bool) { resolver.DirectHostResolver = r.Resolver } - lc := inbound.NewListenerConfig() + lc := inbound.NewListenConfig() lc.SetRouteMark(c.ListenRoutingMark) dns.ReCreateServer(c.Listen, lc, s) } diff --git a/hub/route/server.go b/hub/route/server.go index 20e0f0386..6d37d4802 100644 --- a/hub/route/server.go +++ b/hub/route/server.go @@ -168,7 +168,7 @@ func start(cfg *Config) { // handle addr if len(cfg.Addr) > 0 { - lc := inbound.NewListenerConfig() + lc := inbound.NewListenConfig() lc.SetRouteMark(cfg.RoutingMark) l, err := lc.Listen(context.Background(), "tcp", cfg.Addr) if err != nil { @@ -202,7 +202,7 @@ func startTLS(cfg *Config) { return } - lc := inbound.NewListenerConfig() + lc := inbound.NewListenConfig() lc.SetRouteMark(cfg.RoutingMark) l, err := lc.Listen(context.Background(), "tcp", cfg.TLSAddr) if err != nil { @@ -276,7 +276,7 @@ func startUnix(cfg *Config) { // should be used to delete the socket file prior to calling bind with the same path. _ = syscall.Unlink(addr) - lc := inbound.NewListenerConfig() + lc := inbound.NewListenConfig() lc.SetRouteMark(0) // don't set route mark for unix socket l, err := lc.Listen(context.Background(), "unix", addr) if err != nil { diff --git a/listener/anytls/server.go b/listener/anytls/server.go index 696883527..938a2830e 100644 --- a/listener/anytls/server.go +++ b/listener/anytls/server.go @@ -35,7 +35,7 @@ type Listener struct { padding atomic.Pointer[padding.PaddingFactory] } -func New(config LC.AnyTLSServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { +func New(config LC.AnyTLSServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-ANYTLS"), diff --git a/listener/http/server.go b/listener/http/server.go index 23d2676ab..24fb4eab9 100644 --- a/listener/http/server.go +++ b/listener/http/server.go @@ -40,7 +40,7 @@ func (l *Listener) Close() error { } func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { - return NewWithConfig(LC.AuthServer{Enable: true, Listen: addr, AuthStore: authStore.Default}, inbound.NewListenerConfig(), tunnel, additions...) + return NewWithConfig(LC.AuthServer{Enable: true, Listen: addr, AuthStore: authStore.Default}, inbound.NewListenConfig(), tunnel, additions...) } // NewWithAuthenticate @@ -50,10 +50,10 @@ func NewWithAuthenticate(addr string, tunnel C.Tunnel, authenticate bool, additi if !authenticate { store = authStore.Nil } - return NewWithConfig(LC.AuthServer{Enable: true, Listen: addr, AuthStore: store}, inbound.NewListenerConfig(), tunnel, additions...) + return NewWithConfig(LC.AuthServer{Enable: true, Listen: addr, AuthStore: store}, inbound.NewListenConfig(), tunnel, additions...) } -func NewWithConfig(config LC.AuthServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func NewWithConfig(config LC.AuthServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { isDefault := false if len(additions) == 0 { isDefault = true diff --git a/listener/hysteria2_realm/server.go b/listener/hysteria2_realm/server.go index 0ed5d9afe..91009a5ff 100644 --- a/listener/hysteria2_realm/server.go +++ b/listener/hysteria2_realm/server.go @@ -36,7 +36,7 @@ const ( func DefaultALPN() []string { return []string{"h2", "http/1.1"} } -func New(config LC.Hysteria2RealmServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func New(config LC.Hysteria2RealmServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-HYSTERIA2-REALM"), diff --git a/listener/inbound/anytls.go b/listener/inbound/anytls.go index cbbcc7d2c..ee356554a 100644 --- a/listener/inbound/anytls.go +++ b/listener/inbound/anytls.go @@ -74,7 +74,7 @@ func (v *AnyTLS) Address() string { // Listen implements constant.InboundListener func (v *AnyTLS) Listen(tunnel C.Tunnel) error { var err error - v.l, err = anytls.New(v.vs, v.ListenerConfig(), tunnel, v.Additions()...) + v.l, err = anytls.New(v.vs, v.ListenConfig(), tunnel, v.Additions()...) if err != nil { return err } diff --git a/listener/inbound/base.go b/listener/inbound/base.go index 796c4dcea..7f0f5e05b 100644 --- a/listener/inbound/base.go +++ b/listener/inbound/base.go @@ -83,8 +83,8 @@ func (b *Base) Additions() []inbound.Addition { return b.config.Additions() } -func (b *Base) ListenerConfig() *inbound.ListenerConfig { - return b.config.ListenerConfig() +func (b *Base) ListenConfig() *inbound.ListenConfig { + return b.config.ListenConfig() } var _ C.InboundListener = (*Base)(nil) @@ -114,8 +114,8 @@ func (o BaseOption) Additions() []inbound.Addition { } } -func (o BaseOption) ListenerConfig() *inbound.ListenerConfig { - lc := inbound.NewListenerConfig() +func (o BaseOption) ListenConfig() *inbound.ListenConfig { + lc := inbound.NewListenConfig() lc.SetRouteMark(o.RoutingMark) return lc } diff --git a/listener/inbound/http.go b/listener/inbound/http.go index b90b95e28..76397a8b8 100644 --- a/listener/inbound/http.go +++ b/listener/inbound/http.go @@ -59,7 +59,7 @@ func (h *HTTP) Address() string { // Listen implements constant.InboundListener func (h *HTTP) Listen(tunnel C.Tunnel) error { - lc := h.ListenerConfig() + lc := h.ListenConfig() for _, addr := range strings.Split(h.RawAddress(), ",") { l, err := http.NewWithConfig( LC.AuthServer{ diff --git a/listener/inbound/hysteria2.go b/listener/inbound/hysteria2.go index 5255a5bd0..939a45eaf 100644 --- a/listener/inbound/hysteria2.go +++ b/listener/inbound/hysteria2.go @@ -146,7 +146,7 @@ func (t *Hysteria2) Address() string { // Listen implements constant.InboundListener func (t *Hysteria2) Listen(tunnel C.Tunnel) error { var err error - t.l, err = sing_hysteria2.New(t.ts, t.ListenerConfig(), tunnel, t.Additions()...) + t.l, err = sing_hysteria2.New(t.ts, t.ListenConfig(), tunnel, t.Additions()...) if err != nil { return err } diff --git a/listener/inbound/hysteria2_realm.go b/listener/inbound/hysteria2_realm.go index 4f93c1d84..5539b65f1 100644 --- a/listener/inbound/hysteria2_realm.go +++ b/listener/inbound/hysteria2_realm.go @@ -89,7 +89,7 @@ func (t *Hysteria2RealmServer) Address() string { // Listen implements constant.InboundListener func (t *Hysteria2RealmServer) Listen(tunnel C.Tunnel) error { var err error - t.l, err = hysteria2_realm.New(t.ts, t.ListenerConfig(), tunnel, t.Additions()...) + t.l, err = hysteria2_realm.New(t.ts, t.ListenConfig(), tunnel, t.Additions()...) if err != nil { return err } diff --git a/listener/inbound/mieru.go b/listener/inbound/mieru.go index 12120e2ce..a19f557f6 100644 --- a/listener/inbound/mieru.go +++ b/listener/inbound/mieru.go @@ -153,7 +153,7 @@ func buildMieruServerConfig(option *MieruOption, ports utils.IntRanges[uint16]) UserHintIsMandatory: proto.Bool(true), } } - lc := option.ListenerConfig() + lc := option.ListenConfig() return &mieruserver.ServerConfig{ Config: &mierupb.ServerConfig{ PortBindings: portBindings, diff --git a/listener/inbound/mixed.go b/listener/inbound/mixed.go index 70676e05e..45087749d 100644 --- a/listener/inbound/mixed.go +++ b/listener/inbound/mixed.go @@ -64,7 +64,7 @@ func (m *Mixed) Address() string { // Listen implements constant.InboundListener func (m *Mixed) Listen(tunnel C.Tunnel) error { - lc := m.ListenerConfig() + lc := m.ListenConfig() for _, addr := range strings.Split(m.RawAddress(), ",") { config := LC.AuthServer{ Enable: true, diff --git a/listener/inbound/shadowsocks.go b/listener/inbound/shadowsocks.go index 8e704b9d3..14b7f4a2a 100644 --- a/listener/inbound/shadowsocks.go +++ b/listener/inbound/shadowsocks.go @@ -84,7 +84,7 @@ func (s *ShadowSocks) Address() string { // Listen implements constant.InboundListener func (s *ShadowSocks) Listen(tunnel C.Tunnel) error { var err error - s.l, err = sing_shadowsocks.New(s.ss, s.ListenerConfig(), tunnel, s.Additions()...) + s.l, err = sing_shadowsocks.New(s.ss, s.ListenConfig(), tunnel, s.Additions()...) if err != nil { return err } diff --git a/listener/inbound/snell.go b/listener/inbound/snell.go index 3c26190d7..78c255943 100644 --- a/listener/inbound/snell.go +++ b/listener/inbound/snell.go @@ -76,7 +76,7 @@ func (s *Snell) Address() string { func (s *Snell) Listen(tunnel C.Tunnel) error { var err error - s.l, err = snell.New(s.snell, s.ListenerConfig(), tunnel, s.Additions()...) + s.l, err = snell.New(s.snell, s.ListenConfig(), tunnel, s.Additions()...) if err != nil { return err } diff --git a/listener/inbound/socks.go b/listener/inbound/socks.go index 27c707235..be2f93108 100644 --- a/listener/inbound/socks.go +++ b/listener/inbound/socks.go @@ -84,7 +84,7 @@ func (s *Socks) Address() string { // Listen implements constant.InboundListener func (s *Socks) Listen(tunnel C.Tunnel) error { - lc := s.ListenerConfig() + lc := s.ListenConfig() for _, addr := range strings.Split(s.RawAddress(), ",") { config := LC.AuthServer{ Enable: true, diff --git a/listener/inbound/sudoku.go b/listener/inbound/sudoku.go index 4ab54be35..c886bb7ff 100644 --- a/listener/inbound/sudoku.go +++ b/listener/inbound/sudoku.go @@ -114,7 +114,7 @@ func (s *Sudoku) Listen(tunnel C.Tunnel) error { } var errs []error - lc := s.ListenerConfig() + lc := s.ListenConfig() for _, addr := range strings.Split(s.RawAddress(), ",") { conf := s.serverConf conf.Listen = addr diff --git a/listener/inbound/trojan.go b/listener/inbound/trojan.go index 74ee8fc0c..0f322ea79 100644 --- a/listener/inbound/trojan.go +++ b/listener/inbound/trojan.go @@ -105,7 +105,7 @@ func (v *Trojan) Address() string { // Listen implements constant.InboundListener func (v *Trojan) Listen(tunnel C.Tunnel) error { var err error - v.l, err = trojan.New(v.vs, v.ListenerConfig(), tunnel, v.Additions()...) + v.l, err = trojan.New(v.vs, v.ListenConfig(), tunnel, v.Additions()...) if err != nil { return err } diff --git a/listener/inbound/trusttunnel.go b/listener/inbound/trusttunnel.go index 340b17f39..d90ad6199 100644 --- a/listener/inbound/trusttunnel.go +++ b/listener/inbound/trusttunnel.go @@ -82,7 +82,7 @@ func (v *TrustTunnel) Address() string { // Listen implements constant.InboundListener func (v *TrustTunnel) Listen(tunnel C.Tunnel) error { var err error - v.l, err = trusttunnel.New(v.vs, v.ListenerConfig(), tunnel, v.Additions()...) + v.l, err = trusttunnel.New(v.vs, v.ListenConfig(), tunnel, v.Additions()...) if err != nil { return err } diff --git a/listener/inbound/tuic.go b/listener/inbound/tuic.go index d01d7f016..db2363c22 100644 --- a/listener/inbound/tuic.go +++ b/listener/inbound/tuic.go @@ -88,7 +88,7 @@ func (t *Tuic) Address() string { // Listen implements constant.InboundListener func (t *Tuic) Listen(tunnel C.Tunnel) error { var err error - t.l, err = tuic.New(t.ts, t.ListenerConfig(), tunnel, t.Additions()...) + t.l, err = tuic.New(t.ts, t.ListenConfig(), tunnel, t.Additions()...) if err != nil { return err } diff --git a/listener/inbound/tunnel.go b/listener/inbound/tunnel.go index b6af802cc..1dfff0ea4 100644 --- a/listener/inbound/tunnel.go +++ b/listener/inbound/tunnel.go @@ -78,7 +78,7 @@ func (t *Tunnel) Address() string { // Listen implements constant.InboundListener func (t *Tunnel) Listen(tunnel C.Tunnel) error { - lc := t.ListenerConfig() + lc := t.ListenConfig() for _, addr := range strings.Split(t.RawAddress(), ",") { for _, network := range t.config.Network { switch network { diff --git a/listener/inbound/vless.go b/listener/inbound/vless.go index 787757f73..28976c19e 100644 --- a/listener/inbound/vless.go +++ b/listener/inbound/vless.go @@ -148,7 +148,7 @@ func (v *Vless) Address() string { // Listen implements constant.InboundListener func (v *Vless) Listen(tunnel C.Tunnel) error { var err error - v.l, err = sing_vless.New(v.vs, v.ListenerConfig(), tunnel, v.Additions()...) + v.l, err = sing_vless.New(v.vs, v.ListenConfig(), tunnel, v.Additions()...) if err != nil { return err } diff --git a/listener/inbound/vmess.go b/listener/inbound/vmess.go index 9f04c44e7..2642508c1 100644 --- a/listener/inbound/vmess.go +++ b/listener/inbound/vmess.go @@ -92,7 +92,7 @@ func (v *Vmess) Address() string { // Listen implements constant.InboundListener func (v *Vmess) Listen(tunnel C.Tunnel) error { var err error - v.l, err = sing_vmess.New(v.vs, v.ListenerConfig(), tunnel, v.Additions()...) + v.l, err = sing_vmess.New(v.vs, v.ListenConfig(), tunnel, v.Additions()...) if err != nil { return err } diff --git a/listener/listener.go b/listener/listener.go index e9ee2a995..3a0a8aad4 100644 --- a/listener/listener.go +++ b/listener/listener.go @@ -284,7 +284,7 @@ func ReCreateShadowSocks(shadowSocksConfig string, tunnel C.Tunnel) { return } - listener, err := sing_shadowsocks.New(ssConfig, inbound.NewListenerConfig(), tunnel) + listener, err := sing_shadowsocks.New(ssConfig, inbound.NewListenConfig(), tunnel) if err != nil { return } @@ -336,7 +336,7 @@ func ReCreateVmess(vmessConfig string, tunnel C.Tunnel) { return } - listener, err := sing_vmess.New(vsConfig, inbound.NewListenerConfig(), tunnel) + listener, err := sing_vmess.New(vsConfig, inbound.NewListenConfig(), tunnel) if err != nil { return } @@ -381,7 +381,7 @@ func ReCreateTuic(config LC.TuicServer, tunnel C.Tunnel) { return } - listener, err := tuic.New(config, inbound.NewListenerConfig(), tunnel) + listener, err := tuic.New(config, inbound.NewListenConfig(), tunnel) if err != nil { return } @@ -601,7 +601,7 @@ func PatchTunnel(tunnels []LC.Tunnel, tunnel C.Tunnel) { } } - lc := inbound.NewListenerConfig() + lc := inbound.NewListenConfig() for _, elm := range needCreate { key := fmt.Sprintf("%s/%s/%s", elm.addr, elm.target, elm.proxy) if elm.network == "tcp" { diff --git a/listener/mixed/mixed.go b/listener/mixed/mixed.go index d4189c81d..2f7392c8f 100644 --- a/listener/mixed/mixed.go +++ b/listener/mixed/mixed.go @@ -46,10 +46,10 @@ func (l *Listener) Close() error { } func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { - return NewWithConfig(LC.AuthServer{Enable: true, Listen: addr, AuthStore: authStore.Default}, inbound.NewListenerConfig(), tunnel, additions...) + return NewWithConfig(LC.AuthServer{Enable: true, Listen: addr, AuthStore: authStore.Default}, inbound.NewListenConfig(), tunnel, additions...) } -func NewWithConfig(config LC.AuthServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func NewWithConfig(config LC.AuthServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { isDefault := false if len(additions) == 0 { isDefault = true diff --git a/listener/shadowsocks/tcp.go b/listener/shadowsocks/tcp.go index 55367cb35..c5851653e 100644 --- a/listener/shadowsocks/tcp.go +++ b/listener/shadowsocks/tcp.go @@ -28,7 +28,7 @@ type Listener struct { var _listener *Listener -func New(config LC.ShadowsocksServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func New(config LC.ShadowsocksServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { pickCipher, err := core.PickCipher(config.Cipher, nil, config.Password) if err != nil { return nil, err diff --git a/listener/shadowsocks/udp.go b/listener/shadowsocks/udp.go index bbec1f245..72bfa13da 100644 --- a/listener/shadowsocks/udp.go +++ b/listener/shadowsocks/udp.go @@ -18,7 +18,7 @@ type UDPListener struct { closed bool } -func NewUDP(addr string, lc *inbound.ListenerConfig, pickCipher core.Cipher, tunnel C.Tunnel, additions ...inbound.Addition) (*UDPListener, error) { +func NewUDP(addr string, lc *inbound.ListenConfig, pickCipher core.Cipher, tunnel C.Tunnel, additions ...inbound.Addition) (*UDPListener, error) { l, err := lc.ListenPacket(context.Background(), "udp", addr) if err != nil { return nil, err diff --git a/listener/sing_hysteria2/server.go b/listener/sing_hysteria2/server.go index 4af9a4f88..426045f1e 100644 --- a/listener/sing_hysteria2/server.go +++ b/listener/sing_hysteria2/server.go @@ -40,7 +40,7 @@ type Listener struct { services []*hysteria2.Service[string] } -func New(config LC.Hysteria2Server, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func New(config LC.Hysteria2Server, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { var sl *Listener var err error if len(additions) == 0 { diff --git a/listener/sing_shadowsocks/server.go b/listener/sing_shadowsocks/server.go index 44e8ec9df..bfdac0305 100644 --- a/listener/sing_shadowsocks/server.go +++ b/listener/sing_shadowsocks/server.go @@ -53,7 +53,7 @@ func (s *shadowTLSService) NewConnection(ctx context.Context, conn net.Conn, met return s.Service.NewConnection(ctx, conn, metadata) } -func New(config LC.ShadowsocksServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (C.MultiAddrListener, error) { +func New(config LC.ShadowsocksServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (C.MultiAddrListener, error) { var sl *Listener var err error if len(additions) == 0 { diff --git a/listener/sing_vless/server.go b/listener/sing_vless/server.go index b1137c415..b5a1190d4 100644 --- a/listener/sing_vless/server.go +++ b/listener/sing_vless/server.go @@ -35,7 +35,7 @@ type Listener struct { decryption *encryption.ServerInstance } -func New(config LC.VlessServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { +func New(config LC.VlessServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-VLESS"), diff --git a/listener/sing_vmess/server.go b/listener/sing_vmess/server.go index d4c49ac72..6d6ab345f 100644 --- a/listener/sing_vmess/server.go +++ b/listener/sing_vmess/server.go @@ -35,7 +35,7 @@ type Listener struct { var _listener *Listener -func New(config LC.VmessServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { +func New(config LC.VmessServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-VMESS"), diff --git a/listener/snell/server.go b/listener/snell/server.go index ce843c329..220718c3e 100644 --- a/listener/snell/server.go +++ b/listener/snell/server.go @@ -30,7 +30,7 @@ type Listener struct { listeners []net.Listener } -func New(config LC.SnellServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (C.MultiAddrListener, error) { +func New(config LC.SnellServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (C.MultiAddrListener, error) { if config.Version == 0 { config.Version = snell.Version4 } diff --git a/listener/socks/tcp.go b/listener/socks/tcp.go index 3bf71b0e0..50fe38c22 100644 --- a/listener/socks/tcp.go +++ b/listener/socks/tcp.go @@ -49,10 +49,10 @@ func defaultConfig(addr string) LC.AuthServer { } func New(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { - return NewWithConfig(defaultConfig(addr), inbound.NewListenerConfig(), tunnel, additions...) + return NewWithConfig(defaultConfig(addr), inbound.NewListenConfig(), tunnel, additions...) } -func NewWithConfig(config LC.AuthServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func NewWithConfig(config LC.AuthServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { isDefault := false if len(additions) == 0 { isDefault = true diff --git a/listener/socks/udp.go b/listener/socks/udp.go index f52fe538f..963acbacc 100644 --- a/listener/socks/udp.go +++ b/listener/socks/udp.go @@ -36,10 +36,10 @@ func (l *UDPListener) Close() error { } func NewUDP(addr string, tunnel C.Tunnel, additions ...inbound.Addition) (*UDPListener, error) { - return NewUDPWithConfig(defaultConfig(addr), inbound.NewListenerConfig(), tunnel, additions...) + return NewUDPWithConfig(defaultConfig(addr), inbound.NewListenConfig(), tunnel, additions...) } -func NewUDPWithConfig(config LC.AuthServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*UDPListener, error) { +func NewUDPWithConfig(config LC.AuthServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*UDPListener, error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-SOCKS"), diff --git a/listener/sudoku/server.go b/listener/sudoku/server.go index 476983ebe..77b46266b 100644 --- a/listener/sudoku/server.go +++ b/listener/sudoku/server.go @@ -229,7 +229,7 @@ func relayToFallback(wrapper net.Conn, rawConn net.Conn, fallback net.Conn) { N.Relay(rawConn, fallback) } -func New(config LC.SudokuServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func New(config LC.SudokuServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-SUDOKU"), diff --git a/listener/trojan/server.go b/listener/trojan/server.go index 102f52b67..218152c65 100644 --- a/listener/trojan/server.go +++ b/listener/trojan/server.go @@ -38,7 +38,7 @@ type Listener struct { handler *sing.ListenerHandler } -func New(config LC.TrojanServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { +func New(config LC.TrojanServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-TROJAN"), diff --git a/listener/trusttunnel/server.go b/listener/trusttunnel/server.go index 1cccad855..1348a44da 100644 --- a/listener/trusttunnel/server.go +++ b/listener/trusttunnel/server.go @@ -29,7 +29,7 @@ type Listener struct { services []*trusttunnel.Service } -func New(config LC.TrustTunnelServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { +func New(config LC.TrustTunnelServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (sl *Listener, err error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-TRUSTTUNNEL"), diff --git a/listener/tuic/server.go b/listener/tuic/server.go index e71803020..43fc1f1a1 100644 --- a/listener/tuic/server.go +++ b/listener/tuic/server.go @@ -33,7 +33,7 @@ type Listener struct { servers []*tuic.Server } -func New(config LC.TuicServer, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func New(config LC.TuicServer, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { if len(additions) == 0 { additions = []inbound.Addition{ inbound.WithInName("DEFAULT-TUIC"), diff --git a/listener/tunnel/tcp.go b/listener/tunnel/tcp.go index 7cf2209fd..14a629b1d 100644 --- a/listener/tunnel/tcp.go +++ b/listener/tunnel/tcp.go @@ -38,7 +38,7 @@ func (l *Listener) handleTCP(conn net.Conn, tunnel C.Tunnel, additions ...inboun tunnel.HandleTCPConn(inbound.NewSocket(l.target, conn, C.TUNNEL, additions...)) } -func New(addr, target, proxy string, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { +func New(addr, target, proxy string, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) { l, err := lc.Listen(context.Background(), "tcp", addr) if err != nil { return nil, err diff --git a/listener/tunnel/udp.go b/listener/tunnel/udp.go index 8446bce32..36da49dab 100644 --- a/listener/tunnel/udp.go +++ b/listener/tunnel/udp.go @@ -35,7 +35,7 @@ func (l *PacketConn) Close() error { return l.conn.Close() } -func NewUDP(addr, target, proxy string, lc *inbound.ListenerConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*PacketConn, error) { +func NewUDP(addr, target, proxy string, lc *inbound.ListenConfig, tunnel C.Tunnel, additions ...inbound.Addition) (*PacketConn, error) { l, err := lc.ListenPacket(context.Background(), "udp", addr) if err != nil { return nil, err