Skip to content

Commit 70b6486

Browse files
committed
app: add compatibility for previous config
1 parent b81e1d1 commit 70b6486

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

app/proxy.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ import (
1818

1919
func init() {
2020
caddy.RegisterModule(NoProxy{})
21+
caddy.RegisterModule(noProxy{})
2122
caddy.RegisterModule(EnvProxy{})
23+
caddy.RegisterModule(envProxy{})
2224
caddy.RegisterModule(SocksProxy{})
2325
caddy.RegisterModule(HttpProxy{})
2426
}
@@ -52,6 +54,17 @@ func (*NoProxy) Close() error {
5254
return nil
5355
}
5456

57+
type noProxy struct {
58+
NoProxy
59+
}
60+
61+
func (noProxy) CaddyModule() caddy.ModuleInfo {
62+
return caddy.ModuleInfo{
63+
ID: "trojan.proxy.no_proxy",
64+
New: func() caddy.Module { return new(noProxy) },
65+
}
66+
}
67+
5568
// EnvProxy is ...
5669
type EnvProxy struct {
5770
proxy.Dialer `json:"-,omitempty"`
@@ -86,6 +99,17 @@ func (*EnvProxy) ListenPacket(network, addr string) (net.PacketConn, error) {
8699
return nil, errors.New("proxy from environment does not support UDP")
87100
}
88101

102+
type envProxy struct {
103+
EnvProxy
104+
}
105+
106+
func (envProxy) CaddyModule() caddy.ModuleInfo {
107+
return caddy.ModuleInfo{
108+
ID: "trojan.proxy.env_proxy",
109+
New: func() caddy.Module { return new(envProxy) },
110+
}
111+
}
112+
89113
// SocksProxy is a caddy module and supports socks5 proxy server.
90114
// All tcp connections will be sent to proxy server.
91115
type SocksProxy struct {

0 commit comments

Comments
 (0)