Add PROXY Protocol support for freedom outbound

This commit is contained in:
Iain Lau 2024-02-03 09:10:23 +08:00 committed by yuhan6665
父節點 b56917fde5
當前提交 3a99520370
共有 5 個文件被更改,包括 80 次插入22 次删除

查看文件

@ -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
}