ip

package
v0.54.6 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderIpInfo   = "ipinfo"
	ProviderIfconfig = "ifconfig"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChainClient

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

func ProvideChainClient

func ProvideChainClient(ctx context.Context, config cfg.Config, logger log.Logger) (*ChainClient, error)

func (*ChainClient) GetIpData

func (c *ChainClient) GetIpData(ctx context.Context) (*Data, error)

type Client

type Client interface {
	GetIpData(ctx context.Context) (*Data, error)
}

func NewIfConfigClient

func NewIfConfigClient(ctx context.Context, config cfg.Config, logger log.Logger) (Client, error)

func NewIpInfoClient

func NewIpInfoClient(ctx context.Context, config cfg.Config, logger log.Logger) (Client, error)

func ProvideIfConfigClient

func ProvideIfConfigClient(ctx context.Context, config cfg.Config, logger log.Logger) (Client, error)

func ProvideIpInfoClient

func ProvideIpInfoClient(ctx context.Context, config cfg.Config, logger log.Logger) (Client, error)

type Data

type Data struct {
	Ip       string `json:"ip"`
	Hostname string `json:"hostname"`
	City     string `json:"city"`
	Region   string `json:"region"`
	Country  string `json:"country"`
	Loc      string `json:"loc"`
	Org      string `json:"org"`
	Postal   string `json:"postal"`
	Timezone string `json:"timezone"`
	Readme   string `json:"readme"`
}

func ProvideData

func ProvideData(ctx context.Context, config cfg.Config, logger log.Logger) (*Data, error)

type Factory

type Factory func(ctx context.Context, config cfg.Config, logger log.Logger) (Client, error)

type IfConfigClient

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

func (*IfConfigClient) GetIpData

func (c *IfConfigClient) GetIpData(ctx context.Context) (*Data, error)

type IfConfigData

type IfConfigData struct {
	Ip         string  `json:"ip"`
	Hostname   string  `json:"hostname"`
	City       string  `json:"city"`
	RegionName string  `json:"region_name"`
	CountryIso string  `json:"country_iso"`
	Latitude   float64 `json:"latitude"`
	Longitude  float64 `json:"longitude"`
	AsnOrg     string  `json:"asn_org"`
	ZipCode    string  `json:"zip_code"`
	Timezone   string  `json:"time_zone"`
}

type IpInfoClient

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

func (*IpInfoClient) GetIpData

func (c *IpInfoClient) GetIpData(ctx context.Context) (*Data, error)

type IpInfoData

type IpInfoData struct {
	Ip       string `json:"ip"`
	Hostname string `json:"hostname"`
	City     string `json:"city"`
	Region   string `json:"region"`
	Country  string `json:"country"`
	Loc      string `json:"loc"`
	Org      string `json:"org"`
	Postal   string `json:"postal"`
	Timezone string `json:"timezone"`
	Readme   string `json:"readme"`
}

type ProviderChainConfig

type ProviderChainConfig struct {
	Providers []string `cfg:"providers" json:"providers" default:"ipinfo,ifconfig"`
}

Jump to

Keyboard shortcuts

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