Documentation ¶
Index ¶
- Constants
- func JSONStructToMap[T any](m map[string]interface{}) (*T, error)
- type APIPermission
- type AutoSyncClient
- func (c *AutoSyncClient) ForceSync() error
- func (c *AutoSyncClient) GetDomain(domain string) (*Domain, error)
- func (c *AutoSyncClient) GetDomains() []Domain
- func (c *AutoSyncClient) GetURL(url string) (*URL, error)
- func (c *AutoSyncClient) GetURLs() []URL
- func (c *AutoSyncClient) StartAutoSync()
- func (c *AutoSyncClient) StopAutoSync()
- type Category
- type CreateDomainRequest
- type CreateMainTokenRequest
- type CreateMainTokenResponse
- type CreateSessionTokenRequest
- type CreateURLRequest
- type CreateUserRequest
- type Domain
- type PartialMainToken
- type RawClient
- func (c *RawClient) AddDomain(domain string, options CreateDomainRequest) (*Domain, error)
- func (c *RawClient) AddURL(url string, options CreateURLRequest) (*URL, error)
- func (c *RawClient) ConnectWS(ctx context.Context, ch chan WSEvent) error
- func (c *RawClient) CreateMainToken(userID int64, options CreateMainTokenRequest) (*CreateMainTokenResponse, error)
- func (c *RawClient) CreateSessionToken() (*SessionToken, error)
- func (c *RawClient) CreateUser(options CreateDomainRequest) (*User, error)
- func (c *RawClient) DeleteDomain(domain string) error
- func (c *RawClient) DeleteMainToken(userID, tokenID int64) error
- func (c *RawClient) DeleteURL(url string) error
- func (c *RawClient) DeleteUser(id int64) error
- func (c *RawClient) GetDomain(domain string) (*Domain, error)
- func (c *RawClient) GetDomains(category Category) (*[]string, error)
- func (c *RawClient) GetDomainsFull() (*[]Domain, error)
- func (c *RawClient) GetMainToken(userID, tokenID int64) (*PartialMainToken, error)
- func (c *RawClient) GetURL(url string) (*URL, error)
- func (c *RawClient) GetURLs(category Category) (*[]string, error)
- func (c *RawClient) GetURLsFull() (*[]URL, error)
- func (c *RawClient) GetUser(id int64) (*User, error)
- func (c *RawClient) HasPermission(permission APIPermission) bool
- func (c *RawClient) SetSessionToken(token SessionToken)
- func (c *RawClient) UpdateDomain(domain string, options UpdateDomainRequest) (*Domain, error)
- func (c *RawClient) UpdateURL(url string, options UpdateURLRequest) error
- func (c *RawClient) UpdateUser(id int64, options UpdateUserRequest) error
- type SessionToken
- type URL
- type UpdateDomainRequest
- type UpdateURLRequest
- type UpdateUserRequest
- type User
- type WSCreateDomainData
- type WSCreateURLData
- type WSDeleteDomainData
- type WSDeleteURLData
- type WSEvent
- type WSEventType
- type WSUpdateDomainData
- type WSUpdateURLData
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 ¶
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) GetURLs ¶
func (c *AutoSyncClient) GetURLs() []URL
func (*AutoSyncClient) StartAutoSync ¶
func (c *AutoSyncClient) StartAutoSync()
func (*AutoSyncClient) StopAutoSync ¶
func (c *AutoSyncClient) StopAutoSync()
type CreateDomainRequest ¶
type CreateMainTokenRequest ¶
type CreateMainTokenRequest struct {
Permissions []APIPermission `json:"permissions"`
}
type CreateMainTokenResponse ¶
type CreateSessionTokenRequest ¶
type CreateSessionTokenRequest struct {
Permissions []APIPermission `json:"permissions"`
}
type CreateURLRequest ¶
type CreateUserRequest ¶
type PartialMainToken ¶
type PartialMainToken struct { ID int64 `json:"id"` Permissions []APIPermission `json:"permissions"` }
type RawClient ¶
type RawClient struct {
// contains filtered or unexported fields
}
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 ¶
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 (*RawClient) DeleteMainToken ¶
func (*RawClient) DeleteUser ¶
func (*RawClient) GetDomainsFull ¶
func (*RawClient) GetMainToken ¶
func (c *RawClient) GetMainToken(userID, tokenID int64) (*PartialMainToken, error)
func (*RawClient) GetURLsFull ¶
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 UpdateDomainRequest ¶
type UpdateURLRequest ¶
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 WSCreateURLData ¶
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 ¶
Click to show internal directories.
Click to hide internal directories.