From 1e79a3b75aa5b192aeedff8be226f3e84fd7d4c2 Mon Sep 17 00:00:00 2001 From: v2ray Date: Sat, 30 Jan 2016 12:32:38 +0100 Subject: [PATCH] rename errors --- app/router/rules/router.go | 8 ++++---- proxy/socks/socks.go | 4 ++-- transport/dialer/dialer.go | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/router/rules/router.go b/app/router/rules/router.go index f1d46acf9..53ab166ba 100644 --- a/app/router/rules/router.go +++ b/app/router/rules/router.go @@ -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) } diff --git a/proxy/socks/socks.go b/proxy/socks/socks.go index 9f35cb72a..cf546ff8c 100644 --- a/proxy/socks/socks.go +++ b/proxy/socks/socks.go @@ -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) diff --git a/transport/dialer/dialer.go b/transport/dialer/dialer.go index 306a7b92b..5099fae37 100644 --- a/transport/dialer/dialer.go +++ b/transport/dialer/dialer.go @@ -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))] }