ipeval

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2017 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FactorDescription

type FactorDescription struct {
	GeoContinent      string `json:"geoContinent"`
	GeoCountry        string `json:"geoCountry"`
	GeoCountryCode    string `json:"geoCountryCode"`
	GeoCountryCF      string `json:"geoCountryCF"`
	GeoRegion         string `json:"geoRegion"`
	GeoState          string `json:"geoState"`
	GeoStateCode      string `json:"geoStateCode"`
	GeoStateCF        string `json:"geoStateCF"`
	GeoCity           string `json:"geoCity"`
	GeoCityCF         string `json:"geoCityCF"`
	GeoPostalCode     string `json:"geoPostalCode"`
	GeoAreaCode       string `json:"geoAreaCode"`
	GeoTimeZone       string `json:"geoTimeZone"`
	GeoLatitude       string `json:"geoLatitude"`
	GeoLongitude      string `json:"geoLongitude"`
	Dma               string `json:"dma"`
	Msa               string `json:"msa"`
	ConnectionType    string `json:"connectionType"`
	LineSpeed         string `json:"lineSpeed"`
	IPRoutingType     string `json:"ipRoutingType"`
	GeoAsn            string `json:"geoAsn"`
	Sld               string `json:"sld"`
	Tld               string `json:"tld"`
	Organization      string `json:"organization"`
	Carrier           string `json:"carrier"`
	AnonymizerStatus  string `json:"anonymizer_status"`
	ProxyLevel        string `json:"proxyLevel"`
	ProxyType         string `json:"proxyType"`
	ProxyLastDetected string `json:"proxyLastDetected"`
	HostingFacility   string `json:"hostingFacility"`
	ThreatType        string `json:"threatType"`
	ThreatCategory    string `json:"threatCategory"`
}

FactorDescription :

Struct providing data from the post request.

type Factoring

type Factoring struct {
	Latitude       float32 `json:"latitude"`
	Longitude      float32 `json:"longitude"`
	ThreatType     float32 `json:"threatType"`
	ThreatCategory float32 `json:"threatCategory"`
}

Factoring :

Struct providing data from the post request.

type GeoLoc

type GeoLoc struct {
	Country      *string `json:"country"`
	CountryCode  *string `json:"country_code"`
	Region       *string `json:"region"`
	RegionCode   *string `json:"region_code"`
	City         *string `json:"city"`
	Latitude     *string `json:"latitude"`
	Longtitude   *string `json:"longtitude"`
	Isp          *string `json:"internet_service_provider"`
	Organization *string `json:"organization"`
}

GeoLoc :

Struct providing data from the post request.

type IPEvaluation

type IPEvaluation struct {
	Method        *string            `json:"method"`
	IP            *string            `json:"ip"`
	RiskFactor    *float32           `json:"risk_factor"`
	RiskColor     *string            `json:"risk_color"`
	RiskDesc      *string            `json:"risk_desc"`
	GeoLoc        *GeoLoc            `json:"geoloc"`
	Factoring     *Factoring         `json:"factoring"`
	FactoringDesc *FactorDescription `json:"factor_description"`
}

IPEvaluation :

Struct providing data from the post request.

type Request

type Request struct {
	UserID    string `json:"user_id"`
	EvalType  string `json:"type"`
	IPAddress string `json:"ip_address"`
}

Request :

Request struct to build the required post parameters.

Fields:

[Required] UserId: the username that you want to evaluate.
[Required] EvalType: currently, only 'risk' is supported. Sets the eval type.
[Required] IpAddress: the IP Address of the user to be evaluated.

func (*Request) EvaluateIP

func (r *Request) EvaluateIP(c *sa.Client, userID string, ipAddress string) (*Response, error)

EvaluateIP :

Helper function for making IpEval Posts

Parameters:

[Required] c: passing in the client containing authorization and host information.
[Required] userId: the user you wish to evaluate via adaptive auth.
[Required] ipAddress: the ip address of the user being evaluated.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.

func (*Request) Post

func (r *Request) Post(c *sa.Client) (*Response, error)

Post :

Executes a post to the adaptauth endpoint.

Parameters:

[Required] r: should have all the required fields of the struct populated before using.
[Required] c: passing in the client containing authorization and host information.

Returns:

Response: Struct marshaled from the Json response from the API endpoints.
Error: If an error is encountered, response will be nil and the error must be handled.

type Response

type Response struct {
	IPEvaluation IPEvaluation   `json:"ip_evaluation,omitempty"`
	Status       string         `json:"status"`
	Message      string         `json:"message"`
	RawJSON      string         `json:"-"`
	HTTPResponse *http.Response `json:"-"`
}

Response :

Response struct that will be populated after the post request.

func (*Response) IsSignatureValid added in v1.1.0

func (r *Response) IsSignatureValid(c *sa.Client) (bool, error)

IsSignatureValid :

Helper function to validate the SecureAuth Response signature in X-SA-SIGNATURE

Parameters:

[Required] r: response struct with HTTPResponse
[Required] c: passing in the client with application id and key

Returns:

bool: if true, computed signature matches X-SA-SIGNATURE. if false, computed signature does not match.
error: If an error is encountered, bool will be false and the error must be handled.

Jump to

Keyboard shortcuts

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