1
0
mirror of https://github.com/bestnite/sub2clash.git synced 2025-12-15 18:40:16 +00:00

🐛 Fix trojan parser missing fields

This commit is contained in:
2024-04-23 13:36:33 +08:00
parent aa9e102a81
commit 48dece2a51
5 changed files with 166 additions and 28 deletions

24
parser/error.go Normal file
View File

@@ -0,0 +1,24 @@
package parser
type ParseError struct {
Type ParseErrorType
Message string
Raw string
}
type ParseErrorType string
const (
ErrInvalidPrefix ParseErrorType = "invalid url prefix"
ErrInvalidStruct ParseErrorType = "invalid struct"
ErrInvalidPort ParseErrorType = "invalid port number"
ErrCannotParseParams ParseErrorType = "cannot parse query parameters"
ErrInvalidBase64 ParseErrorType = "invalid base64"
)
func (e *ParseError) Error() string {
if e.Message != "" {
return string(e.Type) + ": " + e.Message + " \"" + e.Raw + "\""
}
return string(e.Type)
}