chore: all listeners support specialProxy

This commit is contained in:
wwqgtxx
2022-12-05 17:53:54 +08:00
parent fd9c4cbfa5
commit 46d23d9b86
4 changed files with 29 additions and 12 deletions

View File

@ -76,6 +76,7 @@ type BaseOption struct {
Listen string `inbound:"listen,omitempty"`
Port int `inbound:"port,omitempty"`
SpecialRules string `inbound:"rule,omitempty"`
SpecialProxy string `inbound:"proxy,omitempty"`
}
func (o BaseOption) Name() string {
@ -90,6 +91,7 @@ func (o BaseOption) Additions() []inbound.Addition {
return []inbound.Addition{
inbound.WithInName(o.NameStr),
inbound.WithSpecialRules(o.SpecialRules),
inbound.WithSpecialProxy(o.SpecialProxy),
}
}

View File

@ -12,7 +12,6 @@ type TunnelOption struct {
BaseOption
Network []string `inbound:"network"`
Target string `inbound:"target"`
Proxy string `inbound:"proxy,omitempty"`
}
func (o TunnelOption) Equal(config C.InboundConfig) bool {
@ -74,11 +73,11 @@ func (t *Tunnel) Listen(tcpIn chan<- C.ConnContext, udpIn chan<- C.PacketAdapter
for _, network := range t.config.Network {
switch network {
case "tcp":
if t.ttl, err = tunnel.New(t.RawAddress(), t.config.Target, t.config.Proxy, tcpIn, t.Additions()...); err != nil {
if t.ttl, err = tunnel.New(t.RawAddress(), t.config.Target, t.config.SpecialProxy, tcpIn, t.Additions()...); err != nil {
return err
}
case "udp":
if t.tul, err = tunnel.NewUDP(t.RawAddress(), t.config.Target, t.config.Proxy, udpIn, t.Additions()...); err != nil {
if t.tul, err = tunnel.NewUDP(t.RawAddress(), t.config.Target, t.config.SpecialProxy, udpIn, t.Additions()...); err != nil {
return err
}
default: