Add basic clash api

This commit is contained in:
世界 2022-07-19 22:16:49 +08:00
parent c7fabe40ed
commit c5b3e8b042
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
36 changed files with 1498 additions and 41 deletions

View file

@ -0,0 +1,22 @@
package clashapi
var (
ErrUnauthorized = newError("Unauthorized")
ErrBadRequest = newError("Body invalid")
ErrForbidden = newError("Forbidden")
ErrNotFound = newError("Resource not found")
ErrRequestTimeout = newError("Timeout")
)
// HTTPError is custom HTTP error for API
type HTTPError struct {
Message string `json:"message"`
}
func (e *HTTPError) Error() string {
return e.Message
}
func newError(msg string) *HTTPError {
return &HTTPError{Message: msg}
}