Documentation ¶
Overview ¶
Package http @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2022 webos CLI @Author linngc @License
Package http @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2022 central CLI @Author linngc @License
Package internal @Link https://gitee.com/linngc/central-mirror @Copyright Copyright (c) 2022 central CLI @Author linngc @License
Index ¶
- Variables
- func AppendUri(ctx context.Context, remote string, modelPath string) string
- func CheckUriVerify(uris []string) map[string]bool
- func GetCityByIp(ip string) string
- func GetClientIp(ctx context.Context) string
- func GetDomain(src string) string
- func GetDomainByCtx(ctx context.Context) string
- func GetLocalIP() (ip string, err error)
- func GetRemote(ctx context.Context, remote string, modelPath string) *http.Response
- func GetReqClientIp(r *ghttp.Request) string
- func GetUserAgent(ctx context.Context) string
- func NewReadSeeker(readSeeker io.ReadSeeker, limiter *rate.Limiter) io.ReadSeeker
- func NewReader(reader io.Reader, limiter *rate.Limiter) io.Reader
- func NewSpeedLimiter(speed float64) *rate.Limiter
- func Pings(ctx context.Context, remote string) (res map[string]int)
- func SpeedResponse(resp http.ResponseWriter, req *http.Request, filePath string, speed float64) error
- type HttpTime
- type ReadSeeker
- type Reader
- type Weather
- type WeatherCity
- type WeatherDay
Constants ¶
This section is empty.
Variables ¶
View Source
var (
CityMap = make(map[string]WeatherCity)
)
Functions ¶
func GetDomain ¶
GetDomain 获取域名信息 @Param src "https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/"
func NewReadSeeker ¶
func NewReadSeeker(readSeeker io.ReadSeeker, limiter *rate.Limiter) io.ReadSeeker
func NewSpeedLimiter ¶
func SpeedResponse ¶
func SpeedResponse(resp http.ResponseWriter, req *http.Request, filePath string, speed float64) error
SpeedResponse 服务端文件传输限速
Types ¶
type HttpTime ¶
type HttpTime struct { DnsTime time.Duration `json:"dnsTime" dc:"dns响应时间"` ConnectTime time.Duration `json:"connectTime" dc:"链接时间"` ResponseTime time.Duration `json:"responseTime" dc:"请求响应时间"` TotalTime time.Duration `json:"totalTime" dc:"总耗时"` }
HttpTime 请求到响应花费的时间
type ReadSeeker ¶
type ReadSeeker struct { io.ReadSeeker // contains filtered or unexported fields }
type Weather ¶
type Weather struct {
Data WeatherDay
}
type WeatherCity ¶
type WeatherCity struct { Id string `json:"id" dc:"Id"` Pid string `json:"pid" dc:"父ID"` CityCode string `json:"cityCode" dc:"城市ID"` CityName string `json:"cityName" dc:"城市名称"` }
WeatherCity 所有城市名称对应的数据
type WeatherDay ¶
type WeatherDay struct { City string `json:"city" dc:"城市名称"` CityId string `json:"cityId" dc:"城市编号"` Temp string `json:"temp" dc:"Temp"` WD string `json:"wd" dc:"温度"` WS string `json:"ws" dc:"Id"` AP string `json:"ap" dc:"气压"` SD string `json:"sd" dc:"湿度"` WSE string `json:"wse" dc:"风速"` Time string `json:"time" dc:"时间"` IsRadar string `json:"isRadar" dc:"IsRadar"` Radar string `json:"radar" dc:"雷达"` }
WeatherDay 天气信息
Click to show internal directories.
Click to hide internal directories.