egress

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2026 License: MIT Imports: 13 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package egress 经出口在线查询公网 IP 与所在的国家和时区,推出出口所在地的语言

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exit

type Exit struct {
	IP       string `json:"ip"`
	Country  string `json:"country"`
	Timezone string `json:"timezone"`
	Locale   string `json:"locale"`
}

Exit 是一个出口的公网 IP 与按 IP 定位的国家、时区和语言

func Environment

func Environment(ctx context.Context, proxy string, locale string, timezone string) (Exit, error)

Environment 返回账户的语言与时区:两项都给出时原样返回,否则经 proxy 查询出口,未给出的项取出口所在地的语言与时区;查询失败时未给出的项取本机的语言与时区,同时返回查询失败的原因

func Lookup

func Lookup(ctx context.Context, proxy string) (Exit, error)

Lookup 经 proxy 同时请求各查询服务,返回第一个给出有效 IP、国家代码与时区的结果,语言取该国 CLDR 最可能的语言;proxy 为空时直连,总时限 lookupTimeout

Jump to

Keyboard shortcuts

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