Add PROXY Protocol support for freedom outbound

This commit is contained in:
Iain Lau authored and yuhan6665 committed 2024-02-05 10:08:51 -05:00
1 parent b56917fde5
commit 3a99520370
5 files changed
+80 -22

No files matched your search

+4
View File
@@ -17,6 +17,7 @@ type FreedomConfig struct {
Redirect string `json:"redirect"`
UserLevel uint32 `json:"userLevel"`
Fragment *Fragment `json:"fragment"`
ProxyProtocol uint32 `json:"proxyProtocol"`
}
type Fragment struct {
@@ -165,5 +166,8 @@ func (c *FreedomConfig) Build() (proto.Message, error) {
config.DestinationOverride.Server.Address = v2net.NewIPOrDomain(v2net.ParseAddress(host))
}
}
if c.ProxyProtocol > 0 && c.ProxyProtocol <= 2 {
config.ProxyProtocol = c.ProxyProtocol
}
return config, nil
}