brightcloud

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

README

brightcloud

License Go Report Card

A Go package to use the BrightCloud web service.

Example

import "github.com/artooro/brightcloud"

client := brightcloud.New("consumerkey", "consumersecret")

// Get list of categories
categories, err := client.ListCategories()

// Lookup info on a URI
info, err := client.Info("github.com")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID   int    `xml:"catid"`
	Name string `xml:"catname"`
	// Group can be: Security, Legal Liability, IT Resources, and Productivity.
	Group string `xml:"catgroup"`
	// Confidence is from 1-100, this is how confident they are about the BrightCloud classification.
	Confidence int `xml:"conf"`
}

Category represents a BrightCloud category

type HeartBeatResponse

type HeartBeatResponse struct {
	Status     int      `xml:"status"`
	StatusMsg  string   `xml:"statusmsg"`
	UpdateCDN  bool     `xml:"updatecdn"`
	UpdateRTU  bool     `xml:"updatertu"`
	UpdateTime string   `xml:"updatetime"`
	CDNListURI []string `xml:"cdnlist>uri"`
}

HeartBeatResponse from uris endpoint

type InfoResponse

type InfoResponse struct {
	Status    int    `xml:"status"`
	StatusMsg string `xml:"statusmsg"`
	URI       string `xml:"uri"`
	// Categories will only contain the ID and Confidence score
	// you will need to map the ID to the name and group retrieved via ListCategories
	Categories []Category `xml:"categories>cat"`
	// ReputationIndex is a security-related score is based on BrightCloud intelligence
	// on a given URL. 80-100 is trustworthy, 60-79 is low risk, 40-59 is moderate risk,
	// 20-39 is suspicious, and 0-19 is high risk.
	ReputationIndex int `xml:"bcri"`
	// All1Category means the subdomains of the URL are all of the same category
	All1Category int `xml:"a1cat"`
}

InfoResponse contains the web service response on a URI

type OAuth

type OAuth struct {
	// contains filtered or unexported fields
}

OAuth consumer

func NewOauthConsumer

func NewOauthConsumer(key, secret string) *OAuth

NewOauthConsumer will configure a new oauth instance

func (*OAuth) SignRequest

func (o *OAuth) SignRequest(req *http.Request) *http.Request

SignRequest should take a URL and sign it

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service represents the BrightCloud web service

func NewClient

func NewClient(key, secret string) *Service

NewClient authorizes a new brightcloud.Service using Oauth

func (*Service) HeartBeat

func (s *Service) HeartBeat() (*HeartBeatResponse, error)

HeartBeat web service status

func (*Service) Info

func (s *Service) Info(reqURL string) (*InfoResponse, error)

Info will get list of categories a URL is tagged in

func (*Service) ListCategories

func (s *Service) ListCategories() ([]Category, error)

ListCategories will list available BrightCloud categories

Jump to

Keyboard shortcuts

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