Documentation
¶
Index ¶
- Constants
- Variables
- func CreateJWT[T any](secret string, claims JWTClaims[T]) (string, error)
- func Decrypt(secret, value string) (string, error)
- func Encrypt(secret, value string) (string, error)
- func GetClientIP(r *http.Request) string
- func GetRequestIP(r *http.Request) string
- func GetRequestIPHeaders(r *http.Request) map[string]string
- func LogError(r *http.Request, msg string, err error)
- func NormalizeMagnetHash(hash string) string
- func ParseJWT[T any](secretFunc jwt.Keyfunc, encodedToken string, claims *JWTClaims[T], ...) (*jwt.Token, error)
- func UnmarshalJSON(statusCode int, body []byte, v any) error
- type APIError
- type Error
- type ErrorCode
- type ErrorType
- type JWTClaims
- type MagnetLink
- type StoreError
- type StremThruError
- type UpstreamError
Constants ¶
View Source
const ( ErrorTypeAPI = server.LegacyErrorTypeAPI ErrorTypeStore = server.LegacyErrorTypeStore ErrorTypeUpstream = server.LegacyErrorTypeUpstream ErrorTypeUnknown = server.LegacyErrorTypeUnknown )
View Source
const ( ErrorCodeUnknown = server.ErrorCodeUnknown ErrorCodeBadGateway = server.ErrorCodeBadGateway ErrorCodeBadRequest = server.ErrorCodeBadRequest ErrorCodeConflict = server.ErrorCodeConflict ErrorCodeForbidden = server.ErrorCodeForbidden ErrorCodeGone = server.ErrorCodeGone ErrorCodeInternalServerError = server.ErrorCodeInternalServerError ErrorCodeMethodNotAllowed = server.ErrorCodeMethodNotAllowed ErrorCodeNotFound = server.ErrorCodeNotFound ErrorCodeNotImplemented = server.ErrorCodeNotImplemented ErrorCodePaymentRequired = server.ErrorCodePaymentRequired ErrorCodeProxyAuthenticationRequired = server.ErrorCodeProxyAuthenticationRequired ErrorCodeTooManyRequests = server.ErrorCodeTooManyRequests ErrorCodeUnprocessableEntity = server.ErrorCodeUnprocessableEntity ErrorCodeUnsupportedMediaType = server.ErrorCodeUnsupportedMediaType ErrorCodeStoreLimitExceeded = server.ErrorCodeStoreLimitExceeded ErrorCodeStoreMagnetInvalid = server.ErrorCodeStoreMagnetInvalid ErrorCodeStoreNameInvalid = server.ErrorCodeStoreNameInvalid ErrorCodeStoreServerDown = server.ErrorCodeStoreServerDown )
View Source
const EncryptionFormat = "AES-GCM-256"
Variables ¶
View Source
var HasVideoExtension = func() func(filename string) bool { videoExtensions := map[string]bool{ ".3g2": true, ".3gp": true, ".amv": true, ".asf": true, ".avi": true, ".drc": true, ".f4a": true, ".f4b": true, ".f4p": true, ".f4v": true, ".flv": true, ".gif": true, ".gifv": true, ".m2ts": true, ".m2v": true, ".m4p": true, ".m4v": true, ".mk3d": true, ".mkv": true, ".mng": true, ".mov": true, ".mp2": true, ".mp4": true, ".mpe": true, ".mpeg": true, ".mpg": true, ".mpv": true, ".mxf": true, ".nsv": true, ".ogg": true, ".ogm": true, ".ogv": true, ".qt": true, ".rm": true, ".rmvb": true, ".roq": true, ".svi": true, ".ts": true, ".webm": true, ".wmv": true, ".yuv": true, } return func(filename string) bool { _, found := videoExtensions[strings.ToLower(filepath.Ext(filename))] return found } }()
View Source
var PackError = server.PackLegacyError
Functions ¶
func GetClientIP ¶
func GetRequestIP ¶
func NormalizeMagnetHash ¶
Types ¶
type APIError ¶
type APIError struct {
// contains filtered or unexported fields
}
func NewAPIError ¶
type ErrorType ¶
type ErrorType = server.LegacyErrorType
type JWTClaims ¶
type JWTClaims[T any] struct { jwt.RegisteredClaims Data *T `json:"data,omitempty"` }
type MagnetLink ¶
type MagnetLink struct {
Hash string // xt - exact topic
Link string
Name string // dn - display name
Trackers []string // tr - address tracker
RawLink string
}
func ParseMagnetLink ¶
func ParseMagnetLink(value string) (MagnetLink, error)
type StoreError ¶
type StoreError struct {
// contains filtered or unexported fields
}
func NewStoreError ¶
func NewStoreError(msg string) *StoreError
type StremThruError ¶
type StremThruError = server.StremThruError
type UpstreamError ¶
type UpstreamError struct {
// contains filtered or unexported fields
}
func NewUpstreamError ¶
func NewUpstreamError(msg string) *UpstreamError
Click to show internal directories.
Click to hide internal directories.