fishfish

package module
v0.0.0-...-b42f540 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CategorySafe     = "safe"
	CategoryPhishing = "phishing"
	CategoryMalware  = "malware"
)
View Source
const (
	APIPermissionDomains = "domains"
	APIPermissionURLs    = "urls"
	APIPermissionAdmin   = "admin"
)
View Source
const (
	WSEventTypeDomainCreate = "domain_create"
	WSEventTypeDomainUpdate = "domain_update"
	WSEventTypeDomainDelete = "domain_delete"
	WSEventTypeURLCreate    = "url_create"
	WSEventTypeURLUpdate    = "url_update"
	WSEventTypeURLDelete    = "url_delete"
)

Variables

This section is empty.

Functions

func JSONStructToMap

func JSONStructToMap[T any](m map[string]interface{}) (*T, error)

Converts a map of JSON values to a struct Used for WebSockets

Types

type APIPermission

type APIPermission string

type AutoSyncClient

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

func NewAutoSync

func NewAutoSync(primaryToken string, permissions []APIPermission) (*AutoSyncClient, error)

func (*AutoSyncClient) ForceSync

func (c *AutoSyncClient) ForceSync() error

func (*AutoSyncClient) GetDomain

func (c *AutoSyncClient) GetDomain(domain string) (*Domain, error)

func (*AutoSyncClient) GetDomains

func (c *AutoSyncClient) GetDomains() []Domain

func (*AutoSyncClient) GetURL

func (c *AutoSyncClient) GetURL(url string) (*URL, error)

func (*AutoSyncClient) GetURLs

func (c *AutoSyncClient) GetURLs() []URL

func (*AutoSyncClient) StartAutoSync

func (c *AutoSyncClient) StartAutoSync()

func (*AutoSyncClient) StopAutoSync

func (c *AutoSyncClient) StopAutoSync()

type Category

type Category string

type CreateDomainRequest

type CreateDomainRequest struct {
	Category    Category `json:"category"`
	Description string   `json:"description"`
	Target      string   `json:"target,omitempty"`
}

type CreateMainTokenRequest

type CreateMainTokenRequest struct {
	Permissions []APIPermission `json:"permissions"`
}

type CreateMainTokenResponse

type CreateMainTokenResponse struct {
	Expires int64  `json:"expires"`
	ID      int64  `json:"id"`
	Token   string `json:"token"`
}

type CreateSessionTokenRequest

type CreateSessionTokenRequest struct {
	Permissions []APIPermission `json:"permissions"`
}

type CreateURLRequest

type CreateURLRequest struct {
	Category    Category `json:"category"`
	Description string   `json:"description"`
	Target      string   `json:"target,omitempty"`
}

type CreateUserRequest

type CreateUserRequest struct {
	ExternalServiceID string `json:"external_service_id,omitempty"`
	Username          string `json:"username"`
}

type Domain

type Domain struct {
	Domain      string   `json:"name"`
	Description string   `json:"description"`
	Category    Category `json:"category"`
	Added       int64    `json:"added"`
	Checked     int64    `json:"checked"`
	Target      string   `json:"target,omitempty"`
}

type PartialMainToken

type PartialMainToken struct {
	ID          int64           `json:"id"`
	Permissions []APIPermission `json:"permissions"`
}

type RawClient

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

func NewRaw

func NewRaw(primaryToken string, permissions []APIPermission) (*RawClient, error)

func (*RawClient) AddDomain

func (c *RawClient) AddDomain(domain string, options CreateDomainRequest) (*Domain, error)

func (*RawClient) AddURL

func (c *RawClient) AddURL(url string, options CreateURLRequest) (*URL, error)

func (*RawClient) ConnectWS

func (c *RawClient) ConnectWS(ctx context.Context, ch chan WSEvent) error

This will connect to the FishFish API's WebSocket Stream for real-time updates. It will block and write events to the specified channel. It is not recommended to use this function directly, as you will have to manually parse events. If you want to keep an updated database of domains and urls, use the AutoSync client.

func (*RawClient) CreateMainToken

func (c *RawClient) CreateMainToken(userID int64, options CreateMainTokenRequest) (*CreateMainTokenResponse, error)

func (*RawClient) CreateSessionToken

func (c *RawClient) CreateSessionToken() (*SessionToken, error)

func (*RawClient) CreateUser

func (c *RawClient) CreateUser(options CreateDomainRequest) (*User, error)

func (*RawClient) DeleteDomain

func (c *RawClient) DeleteDomain(domain string) error

func (*RawClient) DeleteMainToken

func (c *RawClient) DeleteMainToken(userID, tokenID int64) error

func (*RawClient) DeleteURL

func (c *RawClient) DeleteURL(url string) error

func (*RawClient) DeleteUser

func (c *RawClient) DeleteUser(id int64) error

func (*RawClient) GetDomain

func (c *RawClient) GetDomain(domain string) (*Domain, error)

func (*RawClient) GetDomains

func (c *RawClient) GetDomains(category Category) (*[]string, error)

func (*RawClient) GetDomainsFull

func (c *RawClient) GetDomainsFull() (*[]Domain, error)

func (*RawClient) GetMainToken

func (c *RawClient) GetMainToken(userID, tokenID int64) (*PartialMainToken, error)

func (*RawClient) GetURL

func (c *RawClient) GetURL(url string) (*URL, error)

func (*RawClient) GetURLs

func (c *RawClient) GetURLs(category Category) (*[]string, error)

func (*RawClient) GetURLsFull

func (c *RawClient) GetURLsFull() (*[]URL, error)

func (*RawClient) GetUser

func (c *RawClient) GetUser(id int64) (*User, error)

func (*RawClient) HasPermission

func (c *RawClient) HasPermission(permission APIPermission) bool

Check if the client has the specified permission

func (*RawClient) SetSessionToken

func (c *RawClient) SetSessionToken(token SessionToken)

func (*RawClient) UpdateDomain

func (c *RawClient) UpdateDomain(domain string, options UpdateDomainRequest) (*Domain, error)

func (*RawClient) UpdateURL

func (c *RawClient) UpdateURL(url string, options UpdateURLRequest) error

func (*RawClient) UpdateUser

func (c *RawClient) UpdateUser(id int64, options UpdateUserRequest) error

type SessionToken

type SessionToken struct {
	Token   string `json:"token"`
	Expires int64  `json:"expires"`
}

type URL

type URL struct {
	URL         string   `json:"url"`
	Description string   `json:"description"`
	Category    Category `json:"category"`
	Added       int64    `json:"added"`
	Checked     int64    `json:"checked"`
	Target      string   `json:"target,omitempty"`
}

type UpdateDomainRequest

type UpdateDomainRequest struct {
	Category    Category `json:"category,omitempty"`
	Description string   `json:"description,omitempty"`
	Target      string   `json:"target,omitempty"`
}

type UpdateURLRequest

type UpdateURLRequest struct {
	Category    Category `json:"category,omitempty"`
	Description string   `json:"description,omitempty"`
	Target      string   `json:"target,omitempty"`
}

type UpdateUserRequest

type UpdateUserRequest struct {
	Permissions []APIPermission `json:"permissions"`
	Username    string          `json:"username"`
}

type User

type User struct {
	ExternalServiceID string          `json:"external_service_id,omitempty"`
	ID                int64           `json:"id"`
	Permissions       []APIPermission `json:"permissions"`
	Username          string          `json:"username"`
}

type WSCreateDomainData

type WSCreateDomainData struct {
	Domain      string   `json:"domain"`
	Description string   `json:"description,omitempty"`
	Category    Category `json:"category,omitempty"`
	Target      string   `json:"target,omitempty"`
}

type WSCreateURLData

type WSCreateURLData struct {
	URL         string   `json:"url"`
	Description string   `json:"description,omitempty"`
	Category    Category `json:"category,omitempty"`
	Target      string   `json:"target,omitempty"`
}

type WSDeleteDomainData

type WSDeleteDomainData struct {
	Domain string `json:"domain"`
}

type WSDeleteURLData

type WSDeleteURLData struct {
	URL string `json:"url"`
}

type WSEvent

type WSEvent struct {
	Type WSEventType `json:"type"`
	Data any         `json:"data"`
}

type WSEventType

type WSEventType string

type WSUpdateDomainData

type WSUpdateDomainData struct {
	Domain      string   `json:"domain"`
	Description string   `json:"description,omitempty"`
	Category    Category `json:"category,omitempty"`
	Target      string   `json:"target,omitempty"`
	Checked     int64    `json:"checked,omitempty"`
}

type WSUpdateURLData

type WSUpdateURLData struct {
	URL         string   `json:"url"`
	Description string   `json:"description,omitempty"`
	Category    Category `json:"category,omitempty"`
	Target      string   `json:"target,omitempty"`
	Checked     int64    `json:"checked,omitempty"`
}

Jump to

Keyboard shortcuts

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