You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
v2ray-core/app/policy/config.go

29 lines
723 B

package policy
import (
"time"
)
// Duration converts Second to time.Duration.
func (s *Second) Duration() time.Duration {
return time.Second * time.Duration(s.Value)
}
// OverrideWith overrides current Policy with another one.
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
}
}
}