1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2025-01-04 16:37:12 -05:00

Move proxy errors to proxy/common/errors

This commit is contained in:
V2Ray 2015-10-29 23:59:57 +01:00
parent ce07ea9769
commit 361a22d74d
4 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
package proxy package errors
import ( import (
"errors" "errors"

View File

@ -7,7 +7,7 @@ import (
"github.com/v2ray/v2ray-core/common/alloc" "github.com/v2ray/v2ray-core/common/alloc"
"github.com/v2ray/v2ray-core/common/log" "github.com/v2ray/v2ray-core/common/log"
v2net "github.com/v2ray/v2ray-core/common/net" v2net "github.com/v2ray/v2ray-core/common/net"
"github.com/v2ray/v2ray-core/proxy" proxyerrors "github.com/v2ray/v2ray-core/proxy/common/errors"
"github.com/v2ray/v2ray-core/transport" "github.com/v2ray/v2ray-core/transport"
) )
@ -66,7 +66,7 @@ func ReadAuthentication(reader io.Reader) (auth Socks5AuthenticationRequest, aut
auth.version = buffer.Value[0] auth.version = buffer.Value[0]
if auth.version != socksVersion { if auth.version != socksVersion {
log.Warning("Unknown protocol version %d", auth.version) log.Warning("Unknown protocol version %d", auth.version)
err = proxy.InvalidProtocolVersion err = proxyerrors.InvalidProtocolVersion
return return
} }

View File

@ -12,7 +12,7 @@ import (
"github.com/v2ray/v2ray-core/common/log" "github.com/v2ray/v2ray-core/common/log"
v2net "github.com/v2ray/v2ray-core/common/net" v2net "github.com/v2ray/v2ray-core/common/net"
"github.com/v2ray/v2ray-core/common/retry" "github.com/v2ray/v2ray-core/common/retry"
"github.com/v2ray/v2ray-core/proxy" proxyerrors "github.com/v2ray/v2ray-core/proxy/common/errors"
jsonconfig "github.com/v2ray/v2ray-core/proxy/socks/config/json" jsonconfig "github.com/v2ray/v2ray-core/proxy/socks/config/json"
"github.com/v2ray/v2ray-core/proxy/socks/protocol" "github.com/v2ray/v2ray-core/proxy/socks/protocol"
) )
@ -128,7 +128,7 @@ func (server *SocksServer) handleSocks5(reader *v2net.TimeOutReader, writer io.W
} }
if status != byte(0) { if status != byte(0) {
log.Warning("Invalid user account: %s", upRequest.AuthDetail()) log.Warning("Invalid user account: %s", upRequest.AuthDetail())
return proxy.InvalidAuthentication return proxyerrors.InvalidAuthentication
} }
} }

View File

@ -13,7 +13,7 @@ import (
v2io "github.com/v2ray/v2ray-core/common/io" v2io "github.com/v2ray/v2ray-core/common/io"
"github.com/v2ray/v2ray-core/common/log" "github.com/v2ray/v2ray-core/common/log"
v2net "github.com/v2ray/v2ray-core/common/net" v2net "github.com/v2ray/v2ray-core/common/net"
"github.com/v2ray/v2ray-core/proxy" proxyerrors "github.com/v2ray/v2ray-core/proxy/common/errors"
"github.com/v2ray/v2ray-core/proxy/vmess/config" "github.com/v2ray/v2ray-core/proxy/vmess/config"
"github.com/v2ray/v2ray-core/proxy/vmess/protocol/user" "github.com/v2ray/v2ray-core/proxy/vmess/protocol/user"
"github.com/v2ray/v2ray-core/transport" "github.com/v2ray/v2ray-core/transport"
@ -77,7 +77,7 @@ func (r *VMessRequestReader) Read(reader io.Reader) (*VMessRequest, error) {
userId, timeSec, valid := r.vUserSet.GetUser(buffer.Value[:nBytes]) userId, timeSec, valid := r.vUserSet.GetUser(buffer.Value[:nBytes])
if !valid { if !valid {
return nil, proxy.InvalidAuthentication return nil, proxyerrors.InvalidAuthentication
} }
aesCipher, err := aes.NewCipher(userId.CmdKey()) aesCipher, err := aes.NewCipher(userId.CmdKey())
@ -104,7 +104,7 @@ func (r *VMessRequestReader) Read(reader io.Reader) (*VMessRequest, error) {
if request.Version != Version { if request.Version != Version {
log.Warning("Invalid protocol version %d", request.Version) log.Warning("Invalid protocol version %d", request.Version)
return nil, proxy.InvalidProtocolVersion return nil, proxyerrors.InvalidProtocolVersion
} }
request.RequestIV = buffer.Value[1:17] // 16 bytes request.RequestIV = buffer.Value[1:17] // 16 bytes