mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2025-02-23 07:13:17 +08:00
fix: tradition shadowsocks server not apply additions
https://github.com/MetaCubeX/mihomo/issues/1466
This commit is contained in:
parent
41efc5e5ab
commit
16c95fca87
@ -22,7 +22,7 @@ type Listener struct {
|
|||||||
|
|
||||||
var _listener *Listener
|
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)
|
pickCipher, err := core.PickCipher(config.Cipher, nil, config.Password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -36,7 +36,7 @@ func New(config LC.ShadowsocksServer, tunnel C.Tunnel) (*Listener, error) {
|
|||||||
|
|
||||||
if config.Udp {
|
if config.Udp {
|
||||||
//UDP
|
//UDP
|
||||||
ul, err := NewUDP(addr, pickCipher, tunnel)
|
ul, err := NewUDP(addr, pickCipher, tunnel, additions...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ func New(config LC.ShadowsocksServer, tunnel C.Tunnel) (*Listener, error) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
N.TCPKeepAlive(c)
|
N.TCPKeepAlive(c)
|
||||||
go sl.HandleConn(c, tunnel)
|
go sl.HandleConn(c, tunnel, additions...)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ type UDPListener struct {
|
|||||||
closed bool
|
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)
|
l, err := net.ListenPacket("udp", addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -42,7 +42,7 @@ func NewUDP(addr string, pickCipher core.Cipher, tunnel C.Tunnel) (*UDPListener,
|
|||||||
}
|
}
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
handleSocksUDP(conn, tunnel, data, put, remoteAddr)
|
handleSocksUDP(conn, tunnel, data, put, remoteAddr, additions...)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -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)
|
sl.service, err = shadowaead_2022.NewServiceWithPassword(config.Cipher, config.Password, udpTimeout, h, ntp.Now)
|
||||||
default:
|
default:
|
||||||
err = fmt.Errorf("shadowsocks: unsupported method: %s", config.Cipher)
|
err = fmt.Errorf("shadowsocks: unsupported method: %s", config.Cipher)
|
||||||
return embedSS.New(config, tunnel)
|
return embedSS.New(config, tunnel, additions...)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
Loading…
Reference in New Issue
Block a user