cdn

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 20 Imported by: 0

README

CDN

CDN package for Goravel, support CloudFlare, BaiShan, Huawei, KuoCai, GoEdge.

Documentation

Index

Constants

View Source
const Binding = "cdn"

Variables

Functions

This section is empty.

Types

type BaiShan

type BaiShan struct {
	Token string
}

func (*BaiShan) GetUsage

func (b *BaiShan) GetUsage(domain string, startTime, endTime carbon.Carbon) (uint, error)

GetUsage 获取使用量

func (*BaiShan) RefreshPath

func (b *BaiShan) RefreshPath(paths []string) error

RefreshPath 刷新路径

func (*BaiShan) RefreshUrl

func (b *BaiShan) RefreshUrl(urls []string) error

RefreshUrl 刷新URL

type BaiShanRefreshResponse

type BaiShanRefreshResponse struct {
	Code uint `json:"code"`
	Data any  `json:"data"`
}

type BaiShanUsageResponse

type BaiShanUsageResponse struct {
	Code int `json:"code"`
	Data map[string]struct {
		Domain string   `json:"domain"`
		Data   [][]uint `json:"data"`
	} `json:"data"`
}

type Cdn

type Cdn struct {
	// contains filtered or unexported fields
}

func NewCdn

func NewCdn(config config.Config) *Cdn

func (*Cdn) GetUsage

func (c *Cdn) GetUsage(domain string, startTime, endTime carbon.Carbon) (uint, error)

func (*Cdn) RefreshPath

func (c *Cdn) RefreshPath(paths []string) error

func (*Cdn) RefreshUrl

func (c *Cdn) RefreshUrl(urls []string) error

type CloudFlare

type CloudFlare struct {
	Key, Email string // 密钥
	ZoneID     string // 域名标识
}

func (*CloudFlare) GetUsage

func (s *CloudFlare) GetUsage(domain string, startTime, endTime carbon.Carbon) (uint, error)

GetUsage 获取用量

func (*CloudFlare) RefreshPath

func (s *CloudFlare) RefreshPath(paths []string) error

RefreshPath 刷新路径

func (*CloudFlare) RefreshUrl

func (s *CloudFlare) RefreshUrl(urls []string) error

RefreshUrl 刷新URL

type CloudFlareGraphQLQuery

type CloudFlareGraphQLQuery struct {
	Query     string         `json:"query"`
	Variables map[string]any `json:"variables"`
}

CloudFlareGraphQLQuery 结构体用于构造 GraphQL 查询

type CloudFlareHttpRequests

type CloudFlareHttpRequests struct {
	Data struct {
		Viewer struct {
			Zones []struct {
				HttpRequests1DGroups []struct {
					Sum struct {
						Requests int `json:"requests"`
					} `json:"sum"`
				} `json:"httpRequests1dGroups"`
			} `json:"zones"`
		} `json:"viewer"`
	} `json:"data"`
	Errors []struct {
		Message string `json:"message"`
	} `json:"errors"`
}

CloudFlareHttpRequests 结构体用于解析 GraphQL 查询结果

type GoEdge added in v1.0.1

type GoEdge struct {
	API, AccessKeyID, AccessKey string
}

func (*GoEdge) GetUsage added in v1.0.1

func (r *GoEdge) GetUsage(domain string, startTime, endTime carbon.Carbon) (uint, error)

GetUsage 获取使用量

func (*GoEdge) RefreshPath added in v1.0.1

func (r *GoEdge) RefreshPath(paths []string) error

RefreshPath 刷新路径

func (*GoEdge) RefreshUrl added in v1.0.1

func (r *GoEdge) RefreshUrl(urls []string) error

RefreshUrl 刷新URL

type GoEdgeCommonResponse added in v1.0.1

type GoEdgeCommonResponse struct {
	Code    int    `json:"code"`
	Data    any    `json:"data"`
	Message string `json:"message"`
}

type GoEdgeServerResponse added in v1.0.1

type GoEdgeServerResponse struct {
	Code int `json:"code"`
	Data struct {
		Servers []struct {
			Id              int    `json:"id"`
			IsOn            bool   `json:"isOn"`
			Name            string `json:"name"`
			FirstServerName string `json:"firstServerName"`
		} `json:"servers"`
	} `json:"data"`
	Message string `json:"message"`
}

type GoEdgeTokenResponse added in v1.0.1

type GoEdgeTokenResponse struct {
	Code int `json:"code"`
	Data struct {
		Token     string `json:"token"`
		ExpiresAt int    `json:"expiresAt"`
	} `json:"data"`
	Message string `json:"message"`
}

type GoEdgeUsageResponse added in v1.0.1

type GoEdgeUsageResponse struct {
	Code int `json:"code"`
	Data struct {
		ServerDailyStat struct {
			ServerId      int `json:"serverId"`
			Bytes         int `json:"bytes"`
			CachedBytes   int `json:"cachedBytes"`
			CountRequests int `json:"countRequests"`
		} `json:"serverDailyStat"`
	} `json:"data"`
	Message string `json:"message"`
}

type HuaWei

type HuaWei struct {
	AccessKey, SecretKey string // 密钥
}

func (*HuaWei) GetUsage

func (r *HuaWei) GetUsage(domain string, startTime, endTime carbon.Carbon) (uint, error)

GetUsage 获取用量

func (*HuaWei) RefreshPath

func (r *HuaWei) RefreshPath(paths []string) error

RefreshPath 刷新路径

func (*HuaWei) RefreshUrl

func (r *HuaWei) RefreshUrl(urls []string) error

RefreshUrl 刷新URL

type KuoCai

type KuoCai struct {
	UserName, PassWord string
}

func (*KuoCai) GetUsage

func (r *KuoCai) GetUsage(domain string, startTime, endTime carbon.Carbon) (uint, error)

GetUsage 获取使用量

func (*KuoCai) RefreshPath

func (r *KuoCai) RefreshPath(paths []string) error

RefreshPath 刷新路径

func (*KuoCai) RefreshUrl

func (r *KuoCai) RefreshUrl(urls []string) error

RefreshUrl 刷新URL

type KuoCaiCommonResponse

type KuoCaiCommonResponse struct {
	Code                string `json:"code"`
	Message             string `json:"message"`
	Data                string `json:"data"`
	Success             bool   `json:"success"`
	SuccessWithDateResp bool   `json:"successWithDateResp"`
}

type KuoCaiUsageResponse

type KuoCaiUsageResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Data    struct {
		VisitsSummary struct {
			HitFlux string `json:"hit_flux"`
			ReqNum  int    `json:"req_num"`
			HitNum  int    `json:"hit_num"`
		} `json:"visits_summary"`
		VisitsDetail struct {
			HitFlux struct {
				Unit string    `json:"unit"`
				Data []float64 `json:"data"`
			} `json:"hit_flux"`
			ReqNum []int `json:"req_num"`
			HitNum []int `json:"hit_num"`
		} `json:"visits_detail"`
		Labels []string `json:"labels"`
	} `json:"data"`
	Success             bool `json:"success"`
	SuccessWithDateResp bool `json:"successWithDateResp"`
}

type ServiceProvider

type ServiceProvider struct {
}

func (*ServiceProvider) Boot

func (receiver *ServiceProvider) Boot(app foundation.Application)

func (*ServiceProvider) Register

func (receiver *ServiceProvider) Register(app foundation.Application)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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