mirror of
https://github.com/XTLS/Xray-core.git
synced 2026-10-19 16:16:13 +00:00
Finalmask: Fix panic when udpHop or xicmp fails; Restore udpHop's default interval (#6808)
https://github.com/XTLS/Xray-core/pull/6808#pullrequestreview-5324529175 --------- Co-authored-by: 风扇滑翔翼 <Fangliding.fshxy@outlook.com>
This commit is contained in:
committed by
RPRX
co-authored by
风扇滑翔翼
parent
2953d44734
commit
7780db9bbe
@@ -942,12 +942,19 @@ func (c *UDPHop) Build() (proto.Message, error) {
|
||||
}
|
||||
return nil, errors.New("invalid ip ", ip)
|
||||
}
|
||||
interval := c.Interval
|
||||
if interval.From == 0 && interval.To == 0 {
|
||||
interval.From, interval.To = 30, 30
|
||||
}
|
||||
if interval.From < 5 {
|
||||
return nil, errors.New("interval must be at least 5")
|
||||
}
|
||||
return &udphop.Config{
|
||||
Local: local,
|
||||
Remote: remote,
|
||||
RemoteOnce: remoteOnce,
|
||||
IntervalMin: int64(c.Interval.From),
|
||||
IntervalMax: int64(c.Interval.To),
|
||||
IntervalMin: int64(interval.From),
|
||||
IntervalMax: int64(interval.To),
|
||||
RemoteIPs: remoteIPs,
|
||||
RemotePorts: c.RemotePorts.Build().Ports(),
|
||||
}, nil
|
||||
|
||||
Reference in New Issue
Block a user