Documentation ¶
Index ¶
- Constants
- type Firewall
- func (firewall *Firewall) AddFirewallSubscriber(subscriber FirewallSubscriber)
- func (firewall *Firewall) GenerateTraffic(reputation *supplier.Reputation, time time.Time)
- func (firewall *Firewall) GetDatacenterClassBNetwork() string
- func (firewall *Firewall) GetLastEvents() []*FirewallEvent
- func (firewall *Firewall) GetRules() string
- func (firewall *Firewall) Load(data map[string]interface{})
- func (firewall *Firewall) RemoveFirewallSubscriber(subscriber FirewallSubscriber)
- func (firewall *Firewall) ResetRules()
- func (firewall *Firewall) Save() string
- func (firewall *Firewall) SetRulesAndApply(rules string) error
- func (firewall *Firewall) SubmitIcmp(ipsrc, ipdst string, header [8]byte, payload string) bool
- func (firewall *Firewall) SubmitTcp(ipsrc, ipdst string, srcPort, dstPort uint16, flags uint8, payload string) bool
- func (firewall *Firewall) SubmitUdp(ipsrc, ipdst string, srcPort, dstPort uint16, payload string) bool
- type FirewallEvent
- type FirewallSubscriber
- type JsonPacket
- type Packet
- type PacketGenerator
Constants ¶
const ( PACKET_ICMP = iota PACKET_UDP = iota PACKET_TCP = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Firewall ¶
type Firewall struct {
// contains filtered or unexported fields
}
func NewFirewall ¶
func NewFirewall() *Firewall
func (*Firewall) AddFirewallSubscriber ¶
func (firewall *Firewall) AddFirewallSubscriber(subscriber FirewallSubscriber)
func (*Firewall) GenerateTraffic ¶
func (firewall *Firewall) GenerateTraffic(reputation *supplier.Reputation, time time.Time)
func (*Firewall) GetDatacenterClassBNetwork ¶
GetDatacenterClassBNetwork returns the first 2 numbers of the A.B.C.D/16 of the Datacenter ipv4 class B network
func (*Firewall) GetLastEvents ¶
func (firewall *Firewall) GetLastEvents() []*FirewallEvent
func (*Firewall) RemoveFirewallSubscriber ¶
func (firewall *Firewall) RemoveFirewallSubscriber(subscriber FirewallSubscriber)
func (*Firewall) ResetRules ¶
func (firewall *Firewall) ResetRules()
func (*Firewall) SetRulesAndApply ¶
SetRulesAndApply will try to load the rules into the lua interpreter return error if the rules cannot be applied
func (*Firewall) SubmitIcmp ¶
SubmitIcmp submit an ICMP packet and returns true if it passes through the firewall
type FirewallSubscriber ¶
type FirewallSubscriber interface { // when a rack change from status (RACK_NORMAL_STATE, RACK_OVER_CURRENT, RACK_HEAT_WARNING, RACK_OVER_HEAT, RACK_MELTING) PacketFiltered(event *FirewallEvent) }
FirewallSubscriber is used to be inform when a packet has been filtered by the firewall (mainly used by MainFirewallWidget)
type JsonPacket ¶
type JsonPacket struct { PacketType string Ipsrc string // ip, [IP_IN], or [IP_OUT] Ipdst string // ip, [IP_IN], or [IP_OUT] SrcPort string // port, or [RANDOM] DstPort string // port, or [RANDOM] IcmpHeader string // header (base64) Payload string // payload, or [65K] Tcpflags string // [FIN] and/or [SYN] and/or [RST] and/or [PSH] and/or [ACK] and/or [URG] and/or [ECE] and/or [CWR] Harmless bool }
JsonPacket is the format used to serialize (savegame) a Packet the string values can be a value, or a '[KEYWORD]'
type Packet ¶
type Packet struct { PacketType int Ipsrc string Ipdst string SrcPort uint16 DstPort uint16 IcmpHeader [8]byte Payload string Tcpflags uint8 Harmless bool }
Packet is the internal memory structure representing a normal (or offensive) packet going through the firewall
type PacketGenerator ¶
type PacketGenerator struct {
// contains filtered or unexported fields
}
func NewPacketGenerator ¶
func NewPacketGenerator(dcclassb string) *PacketGenerator
func (*PacketGenerator) GenerateRandomPacket ¶
func (generator *PacketGenerator) GenerateRandomPacket() *Packet
func (*PacketGenerator) SetGame ¶
func (generator *PacketGenerator) SetGame(dcclassb string)