global

package
v0.0.0-...-c619ee2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2025 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Overview

utils

Index

Constants

This section is empty.

Variables

View Source
var (
	HttpClientTimeout = 10 * time.Second
	CookieJar, _      = cookiejar.New(nil)
	ConfigCache       syncx.Map[string, string]
	URLCache          syncx.Map[string, *model.LiveInfo]
	ChannelCache      syncx.Map[string, model.Channel]
	M3U8Cache         = cache.New(3*time.Second, 10*time.Second)
)
View Source
var (
	ErrConfigNotFound    = errors.New("config key not found")
	ErrYoutubeDlNotFound = errors.New("Youtube-dl not found")
)
View Source
var DB *gorm.DB
View Source
var (
	DefaultTransport = &http.Transport{
		Dial:                dialer.Dial,
		IdleConnTimeout:     90 * time.Second,
		MaxIdleConns:        50,
		MaxIdleConnsPerHost: 10,
		TLSClientConfig:     &tls.Config{InsecureSkipVerify: true},
	}
)

Functions

func CleanUrl

func CleanUrl(Url string) string

func ClearSecretToken

func ClearSecretToken()

func CloseBody

func CloseBody(resp any)

func GetAllCategories

func GetAllCategories() []string

func GetBaseURL

func GetBaseURL(rawURL string) string

func GetConfig

func GetConfig(key string) (string, error)

func GetLiveToken

func GetLiveToken() string

func GetSecretToken

func GetSecretToken() string

func InitDB

func InitDB(filepath string) (err error)

func IsValidURL

func IsValidURL(u string) bool

func MergeUrl

func MergeUrl(baseUrl string, partialUrl string) string

func SetConfig

func SetConfig(key, value string) error

func TransportWithProxy

func TransportWithProxy(proxyUrl string) *http.Transport

Types

This section is empty.

Jump to

Keyboard shortcuts

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