1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2026-01-02 07:25:19 -05:00

Update error handling in socks proxy

This commit is contained in:
V2Ray
2015-09-25 17:59:45 +02:00
parent 8c682d32e6
commit d77ba76ccf
5 changed files with 92 additions and 50 deletions

View File

@@ -87,3 +87,33 @@ func NewIPFormatError(ip []byte) IPFormatError {
func (err IPFormatError) Error() string {
return fmt.Sprintf("%sInvalid IP %v", err.Prefix(), err.IP)
}
type ConfigurationError struct {
ErrorCode
}
var configurationErrorInstance = ConfigurationError{ErrorCode: 5}
func NewConfigurationError() ConfigurationError {
return configurationErrorInstance
}
func (r ConfigurationError) Error() string {
return r.Prefix() + "Invalid configuration."
}
type InvalidOperationError struct {
ErrorCode
Operation string
}
func NewInvalidOperationError(operation string) InvalidOperationError {
return InvalidOperationError{
ErrorCode: 6,
Operation: operation,
}
}
func (r InvalidOperationError) Error() string {
return r.Prefix() + "Invalid operation: " + r.Operation
}