mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-30 05:56:54 -05:00
rename errors
This commit is contained in:
parent
f34e253ea3
commit
1e79a3b75a
@ -10,8 +10,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
InvalidRule = errors.New("Invalid Rule")
|
||||
NoRuleApplicable = errors.New("No rule applicable")
|
||||
ErrorInvalidRule = errors.New("Invalid Rule")
|
||||
ErrorNoRuleApplicable = errors.New("No rule applicable")
|
||||
)
|
||||
|
||||
type cacheEntry struct {
|
||||
@ -60,7 +60,7 @@ func (this *Router) takeDetourWithoutCache(dest v2net.Destination) (string, erro
|
||||
return rule.Tag, nil
|
||||
}
|
||||
}
|
||||
return "", NoRuleApplicable
|
||||
return "", ErrorNoRuleApplicable
|
||||
}
|
||||
|
||||
func (this *Router) TakeDetour(dest v2net.Destination) (string, error) {
|
||||
@ -83,7 +83,7 @@ func (this *RouterFactory) Create(rawConfig interface{}) (router.Router, error)
|
||||
router := NewRouter()
|
||||
for _, rule := range rules {
|
||||
if rule == nil {
|
||||
return nil, InvalidRule
|
||||
return nil, ErrorInvalidRule
|
||||
}
|
||||
router.AddRule(rule)
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ import (
|
||||
|
||||
var (
|
||||
ErrorUnsupportedSocksCommand = errors.New("Unsupported socks command.")
|
||||
UnsupportedAuthMethod = errors.New("Unsupported auth method.")
|
||||
ErrorUnsupportedAuthMethod = errors.New("Unsupported auth method.")
|
||||
)
|
||||
|
||||
// SocksServer is a SOCKS 5 proxy server
|
||||
@ -119,7 +119,7 @@ func (this *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.Wri
|
||||
return err
|
||||
}
|
||||
log.Warning("Socks: client doesn't support allowed any auth methods.")
|
||||
return UnsupportedAuthMethod
|
||||
return ErrorUnsupportedAuthMethod
|
||||
}
|
||||
|
||||
authResponse := protocol.NewAuthenticationResponse(expectedAuthMethod)
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
ErrInvalidHost = errors.New("Invalid Host.")
|
||||
ErrorInvalidHost = errors.New("Invalid Host.")
|
||||
)
|
||||
|
||||
func Dial(dest v2net.Destination) (net.Conn, error) {
|
||||
@ -22,7 +22,7 @@ func Dial(dest v2net.Destination) (net.Conn, error) {
|
||||
return nil, err
|
||||
}
|
||||
if len(ips) == 0 {
|
||||
return nil, ErrInvalidHost
|
||||
return nil, ErrorInvalidHost
|
||||
}
|
||||
ip = ips[dice.Roll(len(ips))]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user