iplib

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2018 License: MIT Imports: 5 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.

README

iplib Release Build Status

簡易取得實際IP

Install

go get github.com/goKosPlay/iplib

Example

package main

//author Kos
import (
	 "github.com/goKosPlay/iplib"
	 "fmt"
)
func main() {
	k := iplab.NewIpMod()
	fmt.Println(k.GetIp())
	fmt.Println(k.GetIpDetail()["country_name"])
	fmt.Println(k.GetSelectIpDetail("0.0.0.0"))
}

License

MIT.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IpDetail

type IpDetail struct {
	Ip        string      `json:"ip"`
	City      string      `json:"city"`
	Region    interface{} `json:"region"`
	Country   string      `json:"country"`
	Postal    interface{} `json:"postal"`
	Latitude  float32     `json:"latitude"`
	Longitude float32     `json:"longitude"`
	Timezone  string      `json:"timezone"`
}

type IpList

type IpList = map[string]string

type IpMapData

type IpMapData = map[string]interface{}

type IpMod

type IpMod struct {
	IpAddress NowIP
	IpInfo    IpDetail
}

func NewIpMod

func NewIpMod() *IpMod

func (*IpMod) GetIp

func (self *IpMod) GetIp() string

func (*IpMod) GetIpDetail

func (self *IpMod) GetIpDetail() IpList

func (*IpMod) GetSelectIpDetail

func (self *IpMod) GetSelectIpDetail(ip string) IpList

type NowIP

type NowIP struct {
	Ip string `json:"ip"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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