base

package
v0.0.0-...-9f21544 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NoRedirectClient *resty.Client
	RestyClient      *resty.Client
	HttpClient       *http.Client
)
View Source
var DefaultTimeout = time.Second * 30
View Source
var UploadStateCache = cache.NewMemCache(cache.WithShards[any](32))

storage upload progress, for upload recovery

View Source
var UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36"

Functions

func GetUploadProgress

func GetUploadProgress[T any](driver driver.Driver, keys ...string) (state T, ok bool)

An upload progress can only be made by one process alone, so here you need to get it and then delete it.

func InitClient

func InitClient()

func NewRestyClient

func NewRestyClient() *resty.Client

func SaveUploadProgress

func SaveUploadProgress(driver driver.Driver, state any, keys ...string) bool

Save upload progress for 20 minutes

func UploadToS3

func UploadToS3(ctx context.Context, args S3UploadArgs) error

Types

type Json

type Json map[string]interface{}

type ReqCallback

type ReqCallback func(req *resty.Request)

type S3UploadArgs

type S3UploadArgs struct {
	Endpoint           string
	Region             string
	AccessKeyID        string
	SecretAccessKey    string
	SessionToken       string
	Bucket             string
	Key                string
	ContentType        string
	ContentDisposition string
	Expires            *time.Time
	Body               io.Reader
	Size               int64
	UsePathStyle       bool
	Concurrency        int
}

type TokenResp

type TokenResp struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL