mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-16 01:17:30 -05:00
27 lines
618 B
Go
27 lines
618 B
Go
package policy
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
func (s *Second) Duration() time.Duration {
|
|
return time.Second * time.Duration(s.Value)
|
|
}
|
|
|
|
func (p *Policy) OverrideWith(another *Policy) {
|
|
if another.Timeout != nil {
|
|
if another.Timeout.Handshake != nil {
|
|
p.Timeout.Handshake = another.Timeout.Handshake
|
|
}
|
|
if another.Timeout.ConnectionIdle != nil {
|
|
p.Timeout.ConnectionIdle = another.Timeout.ConnectionIdle
|
|
}
|
|
if another.Timeout.UplinkOnly != nil {
|
|
p.Timeout.UplinkOnly = another.Timeout.UplinkOnly
|
|
}
|
|
if another.Timeout.DownlinkOnly != nil {
|
|
p.Timeout.DownlinkOnly = another.Timeout.DownlinkOnly
|
|
}
|
|
}
|
|
}
|