Documentation
¶
Index ¶
- Variables
- func CanAccess(user *model.User, meta *model.Meta, reqPath string, password string) bool
- func CanWrite(meta *model.Meta, path string) bool
- func ErrorResp(c *gin.Context, err error, code int, l ...bool)
- func ErrorStrResp(c *gin.Context, str string, code int, l ...bool)
- func ErrorWithDataResp(c *gin.Context, err error, code int, data interface{}, l ...bool)
- func GenerateToken(user *model.User) (tokenString string, err error)
- func GetApiUrl(r *http.Request) string
- func GetEtag(file model.Obj) string
- func GetHttpReq(ctx context.Context) *http.Request
- func InvalidateToken(tokenString string) error
- func IsApply(metaPath, reqPath string, applySub bool) bool
- func IsStorageSignEnabled(rawPath string) bool
- func IsTokenInvalidated(tokenString string) bool
- func Pluralize(count int, singular, plural string) string
- func Proxy(w http.ResponseWriter, r *http.Request, link *model.Link, file model.Obj) error
- func ProxyRange(link *model.Link, size int64)
- func ShouldProxy(storage driver.Driver, filename string) bool
- func Sign(obj model.Obj, parent string, encrypt bool) string
- func SuccessResp(c *gin.Context, data ...interface{})
- func SuccessWithMsgResp(c *gin.Context, msg string, data ...interface{})
- type InterceptResponseWriter
- type PageResp
- type Resp
- type UserClaims
- type WrittenResponseWriter
Constants ¶
This section is empty.
Variables ¶
View Source
var NoProxyRange = &model.RangeReadCloser{}
View Source
var SecretKey []byte
Functions ¶
func ErrorWithDataResp ¶
func InvalidateToken ¶
func IsStorageSignEnabled ¶
func IsTokenInvalidated ¶
func ProxyRange ¶
func ShouldProxy ¶
ShouldProxy TODO need optimize when should be proxy? 1. config.MustProxy() 2. storage.WebProxy 3. proxy_types
func SuccessResp ¶
func SuccessWithMsgResp ¶
Types ¶
type InterceptResponseWriter ¶
type InterceptResponseWriter struct {
http.ResponseWriter
io.Writer
}
type PageResp ¶
type PageResp struct {
Content interface{} `json:"content"`
Total int64 `json:"total"`
}
type UserClaims ¶
type UserClaims struct {
Username string `json:"username"`
PwdTS int64 `json:"pwd_ts"`
jwt.RegisteredClaims
}
func ParseToken ¶
func ParseToken(tokenString string) (*UserClaims, error)
type WrittenResponseWriter ¶
type WrittenResponseWriter struct {
http.ResponseWriter
// contains filtered or unexported fields
}
func (*WrittenResponseWriter) IsWritten ¶
func (ww *WrittenResponseWriter) IsWritten() bool
Click to show internal directories.
Click to hide internal directories.