1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-07-01 03:25:23 +00:00
v2fly/app/policy/config.go

27 lines
618 B
Go
Raw Normal View History

2017-11-27 21:09:30 +00:00
package policy
import (
"time"
)
func (s *Second) Duration() time.Duration {
return time.Second * time.Duration(s.Value)
}
func (p *Policy) OverrideWith(another *Policy) {
2017-11-27 22:25:43 +00:00
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
}
}
2017-11-27 21:09:30 +00:00
}