location

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 3 more Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriorityLocal
	PriorityRemoteHttp
	PriorityRemoteService
)
View Source
const (
	ProviderName string = "chain"
)

Variables

This section is empty.

Functions

func GetPriority

func GetPriority(typ ProviderType) int

GetPriority 获取Provider的优先级

Types

type LocationPlugin

type LocationPlugin interface {
	// Init init plugin
	Init(ctx *plugin.InitContext) error
	// GetLocation get location
	GetLocation() (*model.Location, error)
	// Name plugin name
	Name() string
}

LocationPlugin location provider plugin

type Provider

type Provider struct {
	*plugin.PluginBase
	// contains filtered or unexported fields
}

Provider 从环境变量获取地域信息

func (*Provider) Destroy

func (p *Provider) Destroy() error

Destroy 销毁插件,可用于释放资源

func (*Provider) GetLocation

func (p *Provider) GetLocation() (*model.Location, error)

GetLocation 获取地理位置信息

func (*Provider) Init

func (p *Provider) Init(ctx *plugin.InitContext) error

Init 初始化插件

func (*Provider) Name

func (p *Provider) Name() string

Name 插件名称

func (*Provider) Type

func (p *Provider) Type() common.Type

Type 插件类型

type ProviderType

type ProviderType = string
const (
	Local         ProviderType = "local"
	RemoteHttp    ProviderType = "remoteHttp"
	RemoteService ProviderType = "remoteService"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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