cases

package
v1.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SeparateNetworks

func SeparateNetworks(nws []Network, scopeIPs ...net.IP) (netIPv4, netIPv6 []net.IPNet)

SeparateNetworks it selerates source into IPv4 and IPv4 networks

Types

type CidrSgRules

type CidrSgRules struct {
	SGs   SGs
	Rules dict.RBDict[model.CidrSgRuleIdenity, *model.CidrSgRule]
}

CidrSgRules -

func (*CidrSgRules) GetRulesForTrafficAndSG

func (rules *CidrSgRules) GetRulesForTrafficAndSG(tr model.Traffic, sg string) []*model.CidrSgRule

GetRulesForTrafficAndSG -

func (*CidrSgRules) IsEq

func (rules *CidrSgRules) IsEq(order CidrSgRules) bool

IsEq -

func (*CidrSgRules) Load

func (rules *CidrSgRules) Load(ctx context.Context, client SGClient, locals SGs) (err error)

type LocalData

type LocalData struct {
	LocalSGs      SGs
	SG2SGRules    SG2SGRules
	SG2FQDNRules  SG2FQDNRules
	SgIcmpRules   SgIcmpRules
	SgSgIcmpRules SgSgIcmpRules
	CidrSgRules   CidrSgRules
	Networks      SGsNetworks

	ResolvedFQDN *ResolvedFQDN
	SyncStatus   model.SyncStatus
}

LocalData are used by agent to build Host Based Firewall rules

func (*LocalData) IsEq

func (ld *LocalData) IsEq(other LocalData) bool

IsEq checks wether this object is equal the other one

type LocalDataLoader

type LocalDataLoader struct {
	SyncStatus      model.SyncStatus
	MaxLoadDiration time.Duration
}

LocalDataLoader

func (*LocalDataLoader) Load

func (loader *LocalDataLoader) Load(ctx context.Context, client SGClient, ncnf host.NetConf) (res LocalData, err error)

Load -

type Network

type Network = model.Network

Network is type alias

type ResolvedFQDN

ResolvedFQDN -

func (*ResolvedFQDN) Resolve

func (r *ResolvedFQDN) Resolve(ctx context.Context, rules SG2FQDNRules, dnsRes internal.DomainAddressQuerier)

Resolve -

func (*ResolvedFQDN) UpdA

func (r *ResolvedFQDN) UpdA(domain model.FQDN, addr internal.DomainAddresses)

UpdA -

func (*ResolvedFQDN) UpdAAAA

func (r *ResolvedFQDN) UpdAAAA(domain model.FQDN, addr internal.DomainAddresses)

UpdAAAA -

type SG

type SG struct {
	model.SecurityGroup
	LocalIPsV4 iplib.ByIP
	LocalIPsV6 iplib.ByIP
}

SG Secutity Group

func (*SG) IsLocal

func (loc *SG) IsLocal() bool

IsLocal gives true if GS contains any IP from local host

type SG2FQDNRules

type SG2FQDNRules struct {
	SGs   SGs
	Rules []model.FQDNRule
	FQDNs dict.RBSet[model.FQDN]
}

SG2FQDNRules -

func (*SG2FQDNRules) IsEq

func (rules *SG2FQDNRules) IsEq(other SG2FQDNRules) bool

IsEq -

func (*SG2FQDNRules) Load

func (rules *SG2FQDNRules) Load(ctx context.Context, SGSrv SGClient, sgs SGs) (err error)

Load -

func (SG2FQDNRules) RulesForSG

func (rules SG2FQDNRules) RulesForSG(sgName string) []model.FQDNRule

SelectForSG -

type SG2SGRules

type SG2SGRules struct {
	SGs   SGs
	Rules dict.HDict[model.SGRuleIdentity, *model.SGRule]
}

SG2SGRules -

func (SG2SGRules) AllRules

func (rules SG2SGRules) AllRules() []model.SGRule

AllRules -

func (SG2SGRules) In

func (rules SG2SGRules) In(sgTo string) (ret []model.SGRule)

In -

func (*SG2SGRules) IsEq

func (rules *SG2SGRules) IsEq(other SG2SGRules) bool

IsEq -

func (*SG2SGRules) Load

func (rules *SG2SGRules) Load(ctx context.Context, client SGClient, locals SGs) (err error)

Load ...

func (SG2SGRules) Out

func (rules SG2SGRules) Out(sgFrom string) (ret []model.SGRule)

Out -

type SGClient

type SGClient = sgAPI.SecGroupServiceClient

SGClient is a type alias

type SGs

type SGs struct {
	dict.HDict[SgName, *SG]
}

SGs Security Groups dictionary indexed by its names

func (*SGs) IsEq

func (loc *SGs) IsEq(other SGs) bool

IsEq -

func (*SGs) LoadFromIPs

func (loc *SGs) LoadFromIPs(ctx context.Context, client SGClient, localIPs []net.IP) error

LoadFromIPs it loads Local SGs by IPs

func (*SGs) LoadFromNames

func (loc *SGs) LoadFromNames(ctx context.Context, client SGClient, names []string) (err error)

LoadFromNames load SG from its names

func (SGs) Names

func (loc SGs) Names() []SgName

Names get local SG(s) names

type SGsNetworks

type SGsNetworks struct {
	dict.HDict[string, []model.Network]
}

SGsNetworks Secuurity Group Networks dictionary indexed by Name from SG

func (*SGsNetworks) IsEq

func (sgsNws *SGsNetworks) IsEq(other SGsNetworks) bool

IsEq -

func (*SGsNetworks) LoadFromSGNames

func (sgsNws *SGsNetworks) LoadFromSGNames(ctx context.Context, client SGClient, sgNames []string) error

LoadFromSGNames -

type SgIcmpRules

type SgIcmpRules struct {
	SGs   SGs
	Rules dict.HDict[model.SgIcmpRuleID, *model.SgIcmpRule]
}

SgIcmpRules -

func (*SgIcmpRules) IsEq

func (rules *SgIcmpRules) IsEq(other SgIcmpRules) bool

IsEq -

func (*SgIcmpRules) Load

func (rules *SgIcmpRules) Load(ctx context.Context, client SGClient, locals SGs) (err error)

Load get sg-icmp rules from local SG(s)

func (SgIcmpRules) Rules4Sg

func (rules SgIcmpRules) Rules4Sg(sgName string) (ret []model.SgIcmpRule)

Rules4Sg -

type SgName

type SgName = string

SgName is a type alias

type SgSgIcmpRules

type SgSgIcmpRules struct {
	SGs   SGs
	Rules dict.HDict[model.SgSgIcmpRuleID, *model.SgSgIcmpRule]
}

SgSgIcmpRules -

func (SgSgIcmpRules) In

func (rules SgSgIcmpRules) In(sgTo string) (ret []model.SgSgIcmpRule)

In -

func (*SgSgIcmpRules) IsEq

func (rules *SgSgIcmpRules) IsEq(other SgSgIcmpRules) bool

IsEq -

func (*SgSgIcmpRules) Load

func (rules *SgSgIcmpRules) Load(ctx context.Context, client SGClient, locals SGs) (err error)

Load get sg-sg-icmp rules from local SG(s)

func (SgSgIcmpRules) Out

func (rules SgSgIcmpRules) Out(sgFrom string) (ret []model.SgSgIcmpRule)

Out -

Jump to

Keyboard shortcuts

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