Documentation ¶
Index ¶
- Constants
- func GetInterfaceUpdates(nif *net.Interface) (map[string]InterfaceUpdate, error)
- func IsErrorWithStatusCode(err error, code int) bool
- func NormalizeName(name string) string
- type Addr
- type AllDeviceWrapper
- type Client
- func (c *Client) CreateDevice(create *DeviceCreate) (*Device, error)
- func (c *Client) CreateDeviceAndSite(siteDevCreate *SiteAndDeviceCreate) (*Device, error)
- func (c *Client) GetAllDevices() ([]*Device, error)
- func (c *Client) GetDeviceByID(did int) (*Device, error)
- func (c *Client) GetDeviceByIF(name string) (*Device, error)
- func (c *Client) GetDeviceByIP(ip net.IP) (*Device, error)
- func (c *Client) GetDeviceByName(name string) (*Device, error)
- func (c *Client) GetDevices(filter *DevicesFilter) ([]*Device, error)
- func (c *Client) GetInterfaces(did int) ([]Interface, error)
- func (c *Client) SendDNS(url string, buf *bytes.Buffer) error
- func (c *Client) SendFlow(url string, buf *bytes.Buffer) error
- func (c *Client) UpdateExportStatus(status *ExportStatus) error
- func (c *Client) UpdateInterfaces(dev *Device, nif *net.Interface) error
- func (c *Client) UpdateInterfacesDirectly(dev *Device, updates map[string]InterfaceUpdate) error
- type ClientConfig
- type Column
- type DNSQuestion
- type DNSResourceRecord
- func (z *DNSResourceRecord) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *DNSResourceRecord) EncodeMsg(en *msgp.Writer) (err error)
- func (z *DNSResourceRecord) MarshalMsg(b []byte) (o []byte, err error)
- func (z *DNSResourceRecord) Msgsize() (s int)
- func (z *DNSResourceRecord) UnmarshalMsg(bts []byte) (o []byte, err error)
- type DNSResponse
- type Device
- type DeviceCreate
- type DeviceWrapper
- type DevicesFilter
- type Error
- type ExportStatus
- type Interface
- type InterfaceUpdate
- type Plan
- type SiteAndDeviceCreate
- type SiteCreate
Constants ¶
const ( EXPORT_STATUS_OK = "OK" EXPORT_STATUS_ERROR = "ERROR" EXPORT_STATUS_START = "START" EXPORT_STATUS_HALT = "HALT" )
Variables ¶
This section is empty.
Functions ¶
func GetInterfaceUpdates ¶
func GetInterfaceUpdates(nif *net.Interface) (map[string]InterfaceUpdate, error)
func IsErrorWithStatusCode ¶
func NormalizeName ¶
Types ¶
type AllDeviceWrapper ¶
type AllDeviceWrapper struct {
Devices []*Device `json:"devices"`
}
type Client ¶
type Client struct { ClientConfig *http.Client // contains filtered or unexported fields }
func NewClient ¶
func NewClient(config ClientConfig) *Client
func (*Client) CreateDevice ¶
func (c *Client) CreateDevice(create *DeviceCreate) (*Device, error)
func (*Client) CreateDeviceAndSite ¶
func (c *Client) CreateDeviceAndSite(siteDevCreate *SiteAndDeviceCreate) (*Device, error)
func (*Client) GetAllDevices ¶
func (*Client) GetDevices ¶
func (c *Client) GetDevices(filter *DevicesFilter) ([]*Device, error)
func (*Client) UpdateExportStatus ¶
func (c *Client) UpdateExportStatus(status *ExportStatus) error
/internal/cloudExport/status/:id body expects `{status: string, message: string}`
func (*Client) UpdateInterfaces ¶
func (*Client) UpdateInterfacesDirectly ¶
func (c *Client) UpdateInterfacesDirectly(dev *Device, updates map[string]InterfaceUpdate) error
type ClientConfig ¶
type Column ¶
type Column struct { ID uint64 `json:"field_id,string"` Name string `json:"col_name"` Type string `json:"col_type"` }
func (Column) MarshalFlag ¶
func (*Column) UnmarshalFlag ¶
type DNSQuestion ¶
func (*DNSQuestion) DecodeMsg ¶
func (z *DNSQuestion) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*DNSQuestion) EncodeMsg ¶
func (z *DNSQuestion) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*DNSQuestion) MarshalMsg ¶
func (z *DNSQuestion) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*DNSQuestion) Msgsize ¶
func (z *DNSQuestion) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*DNSQuestion) UnmarshalMsg ¶
func (z *DNSQuestion) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type DNSResourceRecord ¶
func (*DNSResourceRecord) DecodeMsg ¶
func (z *DNSResourceRecord) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*DNSResourceRecord) EncodeMsg ¶
func (z *DNSResourceRecord) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*DNSResourceRecord) MarshalMsg ¶
func (z *DNSResourceRecord) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*DNSResourceRecord) Msgsize ¶
func (z *DNSResourceRecord) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*DNSResourceRecord) UnmarshalMsg ¶
func (z *DNSResourceRecord) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type DNSResponse ¶
type DNSResponse struct { Question DNSQuestion Answers []DNSResourceRecord }
func (*DNSResponse) DecodeMsg ¶
func (z *DNSResponse) DecodeMsg(dc *msgp.Reader) (err error)
DecodeMsg implements msgp.Decodable
func (*DNSResponse) EncodeMsg ¶
func (z *DNSResponse) EncodeMsg(en *msgp.Writer) (err error)
EncodeMsg implements msgp.Encodable
func (*DNSResponse) MarshalMsg ¶
func (z *DNSResponse) MarshalMsg(b []byte) (o []byte, err error)
MarshalMsg implements msgp.Marshaler
func (*DNSResponse) Msgsize ¶
func (z *DNSResponse) Msgsize() (s int)
Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
func (*DNSResponse) UnmarshalMsg ¶
func (z *DNSResponse) UnmarshalMsg(bts []byte) (o []byte, err error)
UnmarshalMsg implements msgp.Unmarshaler
type Device ¶
type Device struct { ID int `json:"id,string"` Name string `json:"device_name"` Type string `json:"device_type"` Subtype string `json:"device_subtype"` Description string `json:"device_description"` IP net.IP `json:"ip"` SampleRate int `json:"device_sample_rate,string"` BgpType string `json:"device_bgp_type"` Plan Plan `json:"plan"` CdnAttr string `json:"cdn_attr"` MaxFlowRate int `json:"max_flow_rate"` CompanyID int `json:"company_id,string"` Customs []Column `json:"custom_column_data,omitempty"` }
type DeviceCreate ¶
type DeviceCreate struct { Name string `json:"device_name"` Type string `json:"device_type"` Description string `json:"device_description"` SampleRate int `json:"device_sample_rate,string"` BgpType string `json:"device_bgp_type"` PlanID int `json:"plan_id,omitempty"` SiteID int `json:"site_id,omitempty"` IPs []net.IP `json:"sending_ips"` AllowNoIP bool `json:"-"` CdnAttr string `json:"cdn_attr"` ExportId int `json:"cloud_export_id,omitempty"` Subtype string `json:"device_subtype"` Region string `json:"cloud_region,omitempty"` Zone string `json:"cloud_zone,omitempty"` }
func (*DeviceCreate) NormalizeName ¶
func (c *DeviceCreate) NormalizeName()
type DeviceWrapper ¶
type DeviceWrapper struct {
Device *Device `json:"device"`
}
type DevicesFilter ¶
type ExportStatus ¶
type ExportStatus struct { ID int `json:"export_id"` Status string `json:"status"` Message string `json:"message"` }
func (*ExportStatus) Set ¶
func (e *ExportStatus) Set(s string, m string) *ExportStatus
type InterfaceUpdate ¶
type SiteAndDeviceCreate ¶
type SiteAndDeviceCreate struct { Site *SiteCreate `json:"site"` Device *DeviceCreate `json:"device"` }