mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-11-27 11:01:28 +00:00
32 lines
809 B
Go
32 lines
809 B
Go
|
// Copyright (c) 2018, Open Systems AG. All rights reserved.
|
||
|
//
|
||
|
// Use of this source code is governed by a BSD-style license
|
||
|
// that can be found in the LICENSE file in the root of the source
|
||
|
// tree.
|
||
|
|
||
|
package ja3
|
||
|
|
||
|
import "fmt"
|
||
|
|
||
|
// Error types
|
||
|
const (
|
||
|
LengthErr string = "length check %v failed"
|
||
|
ContentTypeErr string = "content type not matching"
|
||
|
VersionErr string = "version check %v failed"
|
||
|
HandshakeTypeErr string = "handshake type not matching"
|
||
|
SNITypeErr string = "SNI type not supported"
|
||
|
)
|
||
|
|
||
|
// ParseError can be encountered while parsing a segment
|
||
|
type ParseError struct {
|
||
|
errType string
|
||
|
check int
|
||
|
}
|
||
|
|
||
|
func (e *ParseError) Error() string {
|
||
|
if e.errType == LengthErr || e.errType == VersionErr {
|
||
|
return fmt.Sprintf(e.errType, e.check)
|
||
|
}
|
||
|
return fmt.Sprint(e.errType)
|
||
|
}
|