mirror of https://github.com/v2ray/v2ray-core
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.1 KiB
59 lines
1.1 KiB
9 years ago
|
package errors
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
)
|
||
|
|
||
|
type AuthenticationError struct {
|
||
|
AuthDetail interface{}
|
||
|
}
|
||
|
|
||
|
func NewAuthenticationError(detail interface{}) AuthenticationError {
|
||
|
return AuthenticationError{
|
||
|
AuthDetail: detail,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (err AuthenticationError) Error() string {
|
||
|
return fmt.Sprintf("[Error 0x0001] Invalid auth %v", err.AuthDetail)
|
||
|
}
|
||
|
|
||
|
type ProtocolVersionError struct {
|
||
|
Version int
|
||
|
}
|
||
|
|
||
|
func NewProtocolVersionError(version int) ProtocolVersionError {
|
||
|
return ProtocolVersionError{
|
||
|
Version: version,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (err ProtocolVersionError) Error() string {
|
||
|
return fmt.Sprintf("[Error 0x0002] Invalid version %d", err.Version)
|
||
|
}
|
||
|
|
||
|
type CorruptedPacketError struct {
|
||
|
}
|
||
|
|
||
|
func NewCorruptedPacketError() CorruptedPacketError {
|
||
|
return CorruptedPacketError{}
|
||
|
}
|
||
|
|
||
|
func (err CorruptedPacketError) Error() string {
|
||
|
return "[Error 0x0003] Corrupted packet."
|
||
|
}
|
||
|
|
||
|
type IPFormatError struct {
|
||
|
IP []byte
|
||
|
}
|
||
|
|
||
|
func NewIPFormatError(ip []byte) IPFormatError {
|
||
|
return IPFormatError{
|
||
|
IP: ip,
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func (err IPFormatError) Error() string {
|
||
|
return fmt.Sprintf("[Error 0x0004] Invalid IP %v", err.IP)
|
||
|
}
|