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