libgoranger

package
v0.0.0-...-b1ffd0c Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CITY    = "https://suip.biz/?act=iploc"
	COUNTRY = "https://suip.biz/?act=iploc"
	ISP     = "https://suip.biz/?act=ipintpr"
)

API endpoints

View Source
const PRE = "//pre"

PRE is a <pre> HTML tag

Variables

View Source
var ApiEndPoints = []string{
	CITY,
	COUNTRY,
	ISP,
}

ApiEndPoints is a slice of string constants representing API endpoints

View Source
var CountryCodes = []string{}/* 249 elements not displayed */

CountryCodes is a two-letter country codes

View Source
var ReqType = []string{
	"city",
	"country",
	"isp",
}

ReqType is a possible types of request

Functions

func ValidateCountry

func ValidateCountry(ccode string) bool

ValidateCountry checks if given country code is correct

Types

type Goranger

type Goranger struct {
	EndPoint []string
}

Goranger is a main package's data type. EndPoint field may be one of the endpoint constants

func NewGoranger

func NewGoranger() *Goranger

NewGoranger creates Goranger's instance

func (*Goranger) GetRange

func (g *Goranger) GetRange(reqType, req string) ([]string, error)

GetRange is a main package's method. It uses getData() to make request, parses <pre> tag's content and returns it as []string

func (*Goranger) SetEndPoint

func (g *Goranger) SetEndPoint(reqType string) (string, error)

SetEndPoint sets API endpoint by given request type

Jump to

Keyboard shortcuts

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