types

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: May 9, 2023 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const IPPROTO_TCP = 0x06
View Source
const IPPROTO_UDP = 0x11

Variables

This section is empty.

Functions

func CmpIP4s

func CmpIP4s(a, b IP4s) bool

func ParseIP

func ParseIP(ip string) ([4]byte, bool)

Types

type Check

type Check struct {
	Path   string `json:"path"`
	Port   uint16 `json:"port"'`
	Expect uint32 `json:"expect"`
	Host   string `json:"host"`
}

type Checks

type Checks struct {
	Http  []Check `json:"http,omitempty"`
	Https []Check `json:"https,omitempty"`
	Tcp   []Check `json:"tcp,omitempty"`
	Syn   []Check `json:"syn,omitempty"`
	Dns   []Check `json:"dns,omitempty"`
}

type Counters

type Counters struct {
	Up         bool      `json:"up"`
	MAC        MAC       `json:"mac"`
	Concurrent int64     `json:"current_connections"`
	New_flows  uint64    `json:"total_connections"`
	Rx_packets uint64    `json:"rx_packets"`
	Rx_octets  uint64    `json:"rx_octets"`
	Qfailed    uint64    `json:"-"`
	Fp_count   uint64    `json:"-"`
	Fp_time    uint64    `json:"-"`
	Ip         IP4       `json:"-"`
	Latency    uint64    `json:"-"`
	DEFCON     uint8     `json:"-"`
	Rx_pps     uint64    `json:"rx_packets_per_second"`
	Rx_bps     uint64    `json:"rx_octets_per_second"`
	Timestamp  time.Time `json:"-"`
	Vlan       uint16    `json:"-"`
}

func (*Counters) PerSec

func (c *Counters) PerSec(o Counters)

type IP4

type IP4 [4]byte

func (*IP4) IP

func (i *IP4) IP() net.IP

func (IP4) IsNil added in v0.1.4

func (i IP4) IsNil() bool

func (IP4) MarshalJSON

func (i IP4) MarshalJSON() ([]byte, error)

func (IP4) MarshalText

func (i IP4) MarshalText() ([]byte, error)

func (IP4) String

func (i IP4) String() string

func (*IP4) UnmarshalJSON

func (i *IP4) UnmarshalJSON(d []byte) error

func (*IP4) UnmarshalText

func (i *IP4) UnmarshalText(t []byte) error

type IP4s

type IP4s []IP4

func (IP4s) Len

func (h IP4s) Len() int

func (IP4s) Less

func (h IP4s) Less(i, j int) bool

func (IP4s) Swap

func (h IP4s) Swap(i, j int)

type IP6

type IP6 [16]byte

type L4

type L4 struct {
	Port     uint16
	Protocol Protocol
}

func (L4) MarshalJSON

func (l L4) MarshalJSON() ([]byte, error)

func (L4) MarshalText

func (l L4) MarshalText() ([]byte, error)

func (*L4) NP

func (l *L4) NP() [2]byte

func (*L4) PN

func (l *L4) PN() byte

func (L4) String

func (l L4) String() string

func (*L4) UnmarshalText

func (l *L4) UnmarshalText(t []byte) error

type Logger added in v0.1.1

type Logger interface {
	EMERG(string, ...interface{})
	ALERT(string, ...interface{})
	CRIT(string, ...interface{})
	ERR(string, ...interface{})
	WARNING(string, ...interface{})
	NOTICE(string, ...interface{})
	INFO(string, ...interface{})
	DEBUG(string, ...interface{})
}

type MAC

type MAC [6]byte

func (MAC) IsNil added in v0.1.4

func (m MAC) IsNil() bool

func (MAC) MarshalJSON

func (m MAC) MarshalJSON() ([]byte, error)

func (MAC) String

func (m MAC) String() string

func (*MAC) UnmarshalJSON added in v0.1.4

func (m *MAC) UnmarshalJSON(d []byte) error

type NET

type NET struct {
	IP   IP4
	Mask IP4
}

func Net

func Net(s string) (NET, error)

func (*NET) IPNet

func (i *NET) IPNet() (ip net.IP, ipnet net.IPNet)

func (NET) MarshalJSON

func (n NET) MarshalJSON() ([]byte, error)

func (*NET) Net

func (i *NET) Net() (ip IP4)

func (*NET) NetMask added in v0.1.4

func (i *NET) NetMask() NET

func (*NET) Parse added in v0.1.4

func (n *NET) Parse(s string) error

func (*NET) UnmarshalJSON

func (c *NET) UnmarshalJSON(data []byte) error

type NIC

type NIC struct {
	Name  string
	IP    net.IP
	IPNet net.IPNet
	Iface net.Interface
}

type NilLogger added in v0.1.1

type NilLogger struct {
}

func (*NilLogger) ALERT added in v0.1.1

func (l *NilLogger) ALERT(f string, e ...interface{})

func (*NilLogger) CRIT added in v0.1.1

func (l *NilLogger) CRIT(f string, e ...interface{})

func (*NilLogger) DEBUG added in v0.1.1

func (l *NilLogger) DEBUG(f string, e ...interface{})

func (*NilLogger) EMERG added in v0.1.1

func (l *NilLogger) EMERG(f string, e ...interface{})

func (*NilLogger) ERR added in v0.1.1

func (l *NilLogger) ERR(f string, e ...interface{})

func (*NilLogger) INFO added in v0.1.1

func (l *NilLogger) INFO(f string, e ...interface{})

func (*NilLogger) NOTICE added in v0.1.1

func (l *NilLogger) NOTICE(f string, e ...interface{})

func (*NilLogger) WARNING added in v0.1.1

func (l *NilLogger) WARNING(f string, e ...interface{})

type Protocol

type Protocol bool
const (
	TCP Protocol = false
	UDP          = true
)

func (Protocol) MarshalJSON

func (p Protocol) MarshalJSON() ([]byte, error)

func (Protocol) MarshalText

func (p Protocol) MarshalText() ([]byte, error)

func (Protocol) Number

func (p Protocol) Number() uint8

func (Protocol) String

func (p Protocol) String() string

type RHI

type RHI struct {
	Ip IP4
	Up bool
}

type Scounters

type Scounters struct {
	Name        string              `json:"name"`
	Description string              `json:"description"`
	Up          bool                `json:"up"`
	Nalive      uint                `json:"live_backends"`
	Need        uint                `json:"need_backends"`
	Concurrent  int64               `json:"current_connections"`
	New_flows   uint64              `json:"total_connections"`
	Rx_packets  uint64              `json:"rx_packets"`
	Rx_octets   uint64              `json:"rx_octets"`
	Rx_pps      uint64              `json:"rx_packets_per_second"`
	Rx_bps      uint64              `json:"rx_octets_per_second"`
	Backends    map[string]Counters `json:"backends"`
	VIP         IP4                 `json:"vip"`
	Port        uint16              `json:"port"`
	Protocol    Protocol            `json:"protocol"`
	Delete      bool                `json:"-"`
}

func (*Scounters) Service

func (c *Scounters) Service() Thruple

func (*Scounters) Sum

func (c *Scounters) Sum()

type Thruple

type Thruple struct {
	IP       IP4
	Port     uint16
	Protocol Protocol
}

func (*Thruple) L4

func (t *Thruple) L4() L4

func (Thruple) MarshalJSON

func (t Thruple) MarshalJSON() ([]byte, error)

func (*Thruple) String

func (t *Thruple) String() string

Jump to

Keyboard shortcuts

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