chore: change all <= to < in config checks

This commit is contained in:
Toby 2022-10-08 23:23:51 -07:00
parent 4b2fd55060
commit 57590900ac

View File

@ -131,7 +131,7 @@ func (r *Relay) Check() error {
if len(r.Remote) == 0 {
return errors.New("no relay remote address")
}
if r.Timeout != 0 && r.Timeout <= 4 {
if r.Timeout != 0 && r.Timeout < 4 {
return errors.New("invalid relay timeout")
}
return nil
@ -236,16 +236,16 @@ func (c *clientConfig) Check() error {
len(c.TCPRedirect.Listen) == 0 {
return errors.New("please enable at least one mode")
}
if c.Connectivity.HandshakeIdleTimeout != 0 && c.Connectivity.HandshakeIdleTimeout <= 2 {
if c.Connectivity.HandshakeIdleTimeout != 0 && c.Connectivity.HandshakeIdleTimeout < 2 {
return errors.New("invalid handshake idle timeout")
}
if c.Connectivity.MaxIdleTimeout != 0 && c.Connectivity.MaxIdleTimeout <= 4 {
if c.Connectivity.MaxIdleTimeout != 0 && c.Connectivity.MaxIdleTimeout < 4 {
return errors.New("invalid max idle timeout")
}
if c.SOCKS5.Timeout != 0 && c.SOCKS5.Timeout <= 4 {
if c.SOCKS5.Timeout != 0 && c.SOCKS5.Timeout < 4 {
return errors.New("invalid SOCKS5 timeout")
}
if c.HTTP.Timeout != 0 && c.HTTP.Timeout <= 4 {
if c.HTTP.Timeout != 0 && c.HTTP.Timeout < 4 {
return errors.New("invalid HTTP timeout")
}
if c.TUN.Timeout != 0 && c.TUN.Timeout < 4 {
@ -257,10 +257,10 @@ func (c *clientConfig) Check() error {
if len(c.UDPRelay.Listen) > 0 && len(c.UDPRelay.Remote) == 0 {
return errors.New("no UDP relay remote address")
}
if c.TCPRelay.Timeout != 0 && c.TCPRelay.Timeout <= 4 {
if c.TCPRelay.Timeout != 0 && c.TCPRelay.Timeout < 4 {
return errors.New("invalid TCP relay timeout")
}
if c.UDPRelay.Timeout != 0 && c.UDPRelay.Timeout <= 4 {
if c.UDPRelay.Timeout != 0 && c.UDPRelay.Timeout < 4 {
return errors.New("invalid UDP relay timeout")
}
for _, r := range c.TCPRelays {
@ -273,13 +273,13 @@ func (c *clientConfig) Check() error {
return err
}
}
if c.TCPTProxy.Timeout != 0 && c.TCPTProxy.Timeout <= 4 {
if c.TCPTProxy.Timeout != 0 && c.TCPTProxy.Timeout < 4 {
return errors.New("invalid TCP TProxy timeout")
}
if c.UDPTProxy.Timeout != 0 && c.UDPTProxy.Timeout <= 4 {
if c.UDPTProxy.Timeout != 0 && c.UDPTProxy.Timeout < 4 {
return errors.New("invalid UDP TProxy timeout")
}
if c.TCPRedirect.Timeout != 0 && c.TCPRedirect.Timeout <= 4 {
if c.TCPRedirect.Timeout != 0 && c.TCPRedirect.Timeout < 4 {
return errors.New("invalid TCP Redirect timeout")
}
if len(c.Server) == 0 {