Skip to content

Commit

Permalink
fix: tradition shadowsocks server not apply additions
Browse files Browse the repository at this point in the history
  • Loading branch information
wwqgtxx committed Aug 23, 2024
1 parent 41efc5e commit 16c95fc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions listener/shadowsocks/tcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type Listener struct {

var _listener *Listener

func New(config LC.ShadowsocksServer, tunnel C.Tunnel) (*Listener, error) {
func New(config LC.ShadowsocksServer, tunnel C.Tunnel, additions ...inbound.Addition) (*Listener, error) {
pickCipher, err := core.PickCipher(config.Cipher, nil, config.Password)
if err != nil {
return nil, err
Expand All @@ -36,7 +36,7 @@ func New(config LC.ShadowsocksServer, tunnel C.Tunnel) (*Listener, error) {

if config.Udp {
//UDP
ul, err := NewUDP(addr, pickCipher, tunnel)
ul, err := NewUDP(addr, pickCipher, tunnel, additions...)
if err != nil {
return nil, err
}
Expand All @@ -60,7 +60,7 @@ func New(config LC.ShadowsocksServer, tunnel C.Tunnel) (*Listener, error) {
continue
}
N.TCPKeepAlive(c)
go sl.HandleConn(c, tunnel)
go sl.HandleConn(c, tunnel, additions...)
}
}()
}
Expand Down
4 changes: 2 additions & 2 deletions listener/shadowsocks/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ type UDPListener struct {
closed bool
}

func NewUDP(addr string, pickCipher core.Cipher, tunnel C.Tunnel) (*UDPListener, error) {
func NewUDP(addr string, pickCipher core.Cipher, tunnel C.Tunnel, additions ...inbound.Addition) (*UDPListener, error) {
l, err := net.ListenPacket("udp", addr)
if err != nil {
return nil, err
Expand All @@ -42,7 +42,7 @@ func NewUDP(addr string, pickCipher core.Cipher, tunnel C.Tunnel) (*UDPListener,
}
continue
}
handleSocksUDP(conn, tunnel, data, put, remoteAddr)
handleSocksUDP(conn, tunnel, data, put, remoteAddr, additions...)
}
}()

Expand Down
2 changes: 1 addition & 1 deletion listener/sing_shadowsocks/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func New(config LC.ShadowsocksServer, tunnel C.Tunnel, additions ...inbound.Addi
sl.service, err = shadowaead_2022.NewServiceWithPassword(config.Cipher, config.Password, udpTimeout, h, ntp.Now)
default:
err = fmt.Errorf("shadowsocks: unsupported method: %s", config.Cipher)
return embedSS.New(config, tunnel)
return embedSS.New(config, tunnel, additions...)
}
if err != nil {
return nil, err
Expand Down

0 comments on commit 16c95fc

Please sign in to comment.