mirror of
https://github.com/SagerNet/sing-box.git
synced 2024-12-05 04:46:40 +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)
|
||
|
}
|