镜像来自
https://github.com/XTLS/Xray-core.git
已同步 2025-07-04 00:54:14 +00:00
Add reserved to WireGuard config
Fixes https://github.com/XTLS/Xray-core/issues/1730
This commit is contained in:
父節點
6526e74d49
當前提交
ccba465590
共有 5 個文件被更改,包括 34 次插入 和 12 次删除
|
@ -52,6 +52,7 @@ type WireGuardConfig struct {
|
|||
Peers []*WireGuardPeerConfig `json:"peers"`
|
||||
MTU int `json:"mtu"`
|
||||
NumWorkers int `json:"workers"`
|
||||
Reserved []byte `json:"reserved"`
|
||||
}
|
||||
|
||||
func (c *WireGuardConfig) Build() (proto.Message, error) {
|
||||
|
@ -90,6 +91,11 @@ func (c *WireGuardConfig) Build() (proto.Message, error) {
|
|||
// we don't need to process fallback manually
|
||||
config.NumWorkers = int32(c.NumWorkers)
|
||||
|
||||
if len(c.Reserved) != 0 && len(c.Reserved) != 3 {
|
||||
return nil, newError(`"reserved" should be empty or 3 bytes`)
|
||||
}
|
||||
config.Reserved = c.Reserved
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
||||
|
|
載入中…
Add table
Add a link
Reference in a new issue