ip2region

package module
v0.0.0-...-330397d Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2024 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Name

type Name struct {
	Name string `json:"name,omitempty"`
	Code string `json:"code,omitempty"`
	ID   uint   `json:"id,omitempty"`
}

func NewName

func NewName(name, code string, id uint) Name

func (Name) String

func (n Name) String() string

type Provider

type Provider interface {
	Search(ctx context.Context, ip string, langs ...string) (*Result, error)
	Update(ctx context.Context) error
	Close() error
}

type Result

type Result struct {
	IP          string `json:"ip,omitempty"`
	Continent   Name   `json:"continent,omitempty"`
	Country     Name   `json:"country,omitempty"`
	Subdivision Name   `json:"subdivision,omitempty"`
	City        Name   `json:"city,omitempty"`
	ISP         string `json:"isp,omitempty"`
}

func (Result) InfoText

func (r Result) InfoText() string

func (Result) String

func (r Result) String() string

Directories

Path Synopsis
cmd
ip2region Module
pkg
providers
xdb

Jump to

Keyboard shortcuts

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