// main function to lookup an ip
// returns error only if an error happens on connection
// use GetAPIError() to check for api errors
main function to lookup an ip
returns error only if an error happens on connection
use GetAPIError() to check for api errors
// main function to lookup an ip // returns error only if an error happens on connection // use GetAPIError () to check for api errors
func (c *Client) Lookup(ip string) (*IPLookup, error) {
	var result IPLookup
	req := easyreq.Request{
		URL:     fmt.Sprintf(LookupEndPoint, ip),
		Headers: c.getHeaders(),
		Method:  "GET",
	}
	res, err := req.Make()
	if err != nil {
		return nil, err
	}
	defer res.CloseBody()
	if res.StatusCode() >= 500 {
		return nil, ServerError
	}
	err = res.ToJson(&result)
	return &result, err
}
func ( c * Client ) Lookup ( ip string ) ( * IPLookup , error ) { var result IPLookup req := easyreq . Request { URL : fmt . Sprintf ( LookupEndPoint , ip ) , Headers : c . getHeaders ( ) , Method : " " , } res , err := req . Make ( ) if err != nil { return nil , err } defer res . CloseBody ( ) if res . StatusCode ( ) >= 500 { return nil , ServerError } err = res . ToJson ( & result ) return & result , err }
main function to lookup an ip
returns error only if an error happens on connection
use GetAPIError() to check for api errors
main function to lookup an ip returns error only if an error happens on connection use GetAPIError () to check for api errors