forti

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Fortigate_ICMP6_N2P = map[int]string{
	128: "echo",
	129: "echo-reply",
	130: "membership-query",
	132: "membership-reduction",
	131: "membership-report",
	136: "neighbor-advertisement",
	137: "neighbor-redirect",
	135: "neighbor-solicitation",
	2:   "packet-too-big",
	4:   "parameter-problem",
	134: "router-advertisement",
	138: "router-renumbering",
	133: "router-solicitation",
	3:   "time-exceeded",
	1:   "unreachable",
}
View Source
var Fortigate_ICMP6_P2N = map[string]int{
	"echo":                   128,
	"echo-reply":             129,
	"membership-query":       130,
	"membership-reduction":   132,
	"membership-report":      131,
	"neighbor-advertisement": 136,
	"neighbor-redirect":      137,
	"neighbor-solicitation":  135,
	"packet-too-big":         2,
	"parameter-problem":      4,
	"router-advertisement":   134,
	"router-renumbering":     138,
	"router-solicitation":    133,
	"time-exceeded":          3,
	"unreachable":            1,
}
View Source
var Fortigate_ICMP_N2P = map[int]string{
	6:  "alternate-address",
	31: "conversion-error",
	8:  "echo",
	0:  "echo-reply",
	16: "information-reply",
	15: "information-request",
	18: "mask-reply",
	17: "mask-request",
	32: "mobile-redirect",
	12: "parameter-problem",
	5:  "redirect",
	9:  "router-advertisement",
	10: "router-solicitation",
	4:  "source-quench",
	11: "time-exceeded",
	14: "timestamp-reply",
	13: "timestamp-request",
	30: "traceroute",
	3:  "unreachable",
}
View Source
var Fortigate_ICMP_P2N = map[string]int{
	"alternate-address":    6,
	"conversion-error":     31,
	"echo":                 8,
	"echo-reply":           0,
	"information-reply":    16,
	"information-request":  15,
	"mask-reply":           18,
	"mask-request":         17,
	"mobile-redirect":      32,
	"parameter-problem":    12,
	"redirect":             5,
	"router-advertisement": 9,
	"router-solicitation":  10,
	"source-quench":        4,
	"time-exceeded":        11,
	"timestamp-reply":      14,
	"timestamp-request":    13,
	"traceroute":           30,
	"unreachable":          3,
}
View Source
var Fortigate_NumToProtocol = map[int]string{
	51:  "ah",
	88:  "eigrp",
	58:  "icmp6",
	50:  "esp",
	47:  "gre",
	1:   "icmp",
	2:   "igmp",
	9:   "igrp",
	255: "ip",
	4:   "ipinip",
	94:  "nos",
	89:  "ospf",
	108: "pcp",
	109: "snp",
	6:   "tcp",
	132: "sctp",
	17:  "udp",
	103: "pim",

	256: "tcp-udp",
}
View Source
var Fortigate_ProtocolToNum = map[string]int{
	"ah":      51,
	"icmp6":   58,
	"eigrp":   88,
	"esp":     50,
	"gre":     47,
	"icmp":    1,
	"igmp":    2,
	"igrp":    9,
	"ip":      255,
	"ipinip":  4,
	"nos":     94,
	"ospf":    89,
	"pcp":     108,
	"sctp":    132,
	"snp":     109,
	"tcp":     6,
	"udp":     17,
	"pim":     103,
	"ipsec":   50,
	"pptp":    47,
	"tcp-udp": 256,
}
View Source
var Fortigate_TCP_N2P = map[int]string{
	5120: "aol",
	179:  "bgp",
	19:   "chargen",
	3020: "cifs",
	1494: "citrix-ica",

	2748: "ctiqbe",
	13:   "daytime",
	9:    "discard",
	53:   "domain",
	7:    "echo",
	512:  "exec",
	79:   "finger",
	21:   "ftp",
	20:   "ftp-data",
	70:   "gopher",
	1720: "h323",
	101:  "hostname",

	443:  "https",
	113:  "ident",
	143:  "imap4",
	194:  "irc",
	88:   "kerberos",
	543:  "klogin",
	544:  "kshell",
	389:  "ldap",
	636:  "ldaps",
	513:  "login",
	1352: "lotusnotes",
	515:  "lpd",
	139:  "netbios-ssn",
	2049: "nfs",
	119:  "nntp",
	5631: "pcanywhere-data",
	496:  "pim-auto-rp",
	109:  "pop2",
	110:  "pop3",
	1723: "pptp",
	514:  "rsh",
	554:  "rtsp",
	5060: "sip",
	25:   "smtp",
	1521: "sqlnet",
	22:   "ssh",
	111:  "sunrpc",
	49:   "tacacs",
	517:  "talk",
	23:   "telnet",
	540:  "uucp",
	43:   "whois",
	80:   "www",
}
View Source
var Fortigate_TCP_P2N = map[string]int{
	"aol":             5120,
	"bgp":             179,
	"chargen":         19,
	"cifs":            3020,
	"citrix-ica":      1494,
	"cmd":             514,
	"ctiqbe":          2748,
	"daytime":         13,
	"discard":         9,
	"domain":          53,
	"echo":            7,
	"exec":            512,
	"finger":          79,
	"ftp":             21,
	"ftp-data":        20,
	"gopher":          70,
	"h323":            1720,
	"hostname":        101,
	"http":            80,
	"https":           443,
	"ident":           113,
	"imap4":           143,
	"irc":             194,
	"kerberos":        88,
	"klogin":          543,
	"kshell":          544,
	"ldap":            389,
	"ldaps":           636,
	"login":           513,
	"lotusnotes":      1352,
	"lpd":             515,
	"netbios-ssn":     139,
	"nfs":             2049,
	"nntp":            119,
	"pcanywhere-data": 5631,
	"pim-auto-rp":     496,
	"pop2":            109,
	"pop3":            110,
	"pptp":            1723,
	"rsh":             514,
	"rtsp":            554,
	"sip":             5060,
	"smtp":            25,
	"sqlnet":          1521,
	"ssh":             22,
	"sunrpc":          111,
	"tacacs":          49,
	"talk":            517,
	"telnet":          23,
	"uucp":            540,
	"whois":           43,
	"www":             80,
}
View Source
var Fortigate_UDP_N2P = map[int]string{
	512:  "biff",
	68:   "bootpc",
	67:   "bootps",
	3020: "cifs",
	9:    "discard",
	90:   "dnsix",
	53:   "domain",
	7:    "echo",

	500:  "isakmp",
	750:  "kerberos",
	434:  "mobile-ip",
	42:   "nameserver",
	138:  "netbios-dgm",
	137:  "netbios-ns",
	2049: "nfs",
	123:  "ntp",
	5632: "pcanywhere-status",
	496:  "pim-auto-rp",
	1645: "radius",
	1646: "radius-acct",
	520:  "rip",
	5510: "secureid-udp",
	5060: "sip",
	161:  "snmp",
	162:  "snmptrap",
	111:  "sunrpc",
	514:  "syslog",
	49:   "tacacs",
	517:  "talk",
	69:   "tftp",
	37:   "time",
	513:  "who",
	43:   "whois",
	80:   "www",
	177:  "xdmcp",
}
View Source
var Fortigate_UDP_P2N = map[string]int{
	"biff":              512,
	"bootpc":            68,
	"bootps":            67,
	"cifs":              3020,
	"discard":           9,
	"dnsix":             90,
	"domain":            53,
	"echo":              7,
	"http":              80,
	"isakmp":            500,
	"kerberos":          750,
	"mobile-ip":         434,
	"nameserver":        42,
	"netbios-dgm":       138,
	"netbios-ns":        137,
	"nfs":               2049,
	"ntp":               123,
	"pcanywhere-status": 5632,
	"pim-auto-rp":       496,
	"radius":            1645,
	"radius-acct":       1646,
	"rip":               520,
	"secureid-udp":      5510,
	"sip":               5060,
	"snmp":              161,
	"snmptrap":          162,
	"sunrpc":            111,
	"syslog":            514,
	"tacacs":            49,
	"talk":              517,
	"tftp":              69,
	"time":              37,
	"who":               513,
	"whois":             43,
	"www":               80,
	"xdmcp":             177,
}
View Source
var TCP_UDP_P2N = map[string]int{
	"cifs":        3020,
	"discard":     9,
	"domain":      53,
	"echo":        7,
	"http":        80,
	"kerberos":    88,
	"nfs":         2049,
	"pim-auto-rp": 496,
	"sip":         5060,
	"sunrpc":      111,
	"tacacs":      49,
	"talk":        517,
	"www":         80,
}

Functions

func FortigateIcmp6Parse

func FortigateIcmp6Parse(name string) (int, error)

func FortigateIcmpParse

func FortigateIcmpParse(name string) (int, error)

func FortigateParseProtocol

func FortigateParseProtocol(s string) (int, error)

func FortigatePortParse

func FortigatePortParse(port string, protocol string) (int, error)

func FortigateTcpPortParse

func FortigateTcpPortParse(s string) (int, error)

func FortigateTcpUdpPortParse

func FortigateTcpUdpPortParse(s string) (int, error)

func FortigateUdpPortParse

func FortigateUdpPortParse(s string) (int, error)

Types

type AclIterator

type AclIterator struct {
	*firewall.BaseIterator
}

AclIterator 实现 FortiGate 没有 ACL 概念,策略本身就是类似 ACL 的规则 这里返回一个空的迭代器或者返回策略名称作为 ACL 名称

type FortiAcl

type FortiAcl struct {
	// contains filtered or unexported fields
}

FortiAcl 是一个简单的 ACL 名称包装器

func (*FortiAcl) Name

func (a *FortiAcl) Name() string

type FortiGateDNatMappedAddressValidator

type FortiGateDNatMappedAddressValidator struct{}

func (FortiGateDNatMappedAddressValidator) Validate

func (dv FortiGateDNatMappedAddressValidator) Validate(data map[string]interface{}) validator.Result

type FortiGateDNatTargetIsExistValidator

type FortiGateDNatTargetIsExistValidator struct{}

func (FortiGateDNatTargetIsExistValidator) Validate

func (dv FortiGateDNatTargetIsExistValidator) Validate(data map[string]interface{}) validator.Result

type FortiGateDNatTargetServiceValidator

type FortiGateDNatTargetServiceValidator struct{}

func (FortiGateDNatTargetServiceValidator) Validate

func (dp FortiGateDNatTargetServiceValidator) Validate(data map[string]interface{}) validator.Result

type FortiNatPoolWrapper

type FortiNatPoolWrapper struct {
	// contains filtered or unexported fields
}

FortiNatPoolWrapper 将 NatRule 包装为 NatPool

func (*FortiNatPoolWrapper) Cli

func (p *FortiNatPoolWrapper) Cli() string

func (*FortiNatPoolWrapper) ID

func (p *FortiNatPoolWrapper) ID() string

func (*FortiNatPoolWrapper) MatchNetworkGroup

func (p *FortiNatPoolWrapper) MatchNetworkGroup(ng *network.NetworkGroup) bool

func (*FortiNatPoolWrapper) Name

func (p *FortiNatPoolWrapper) Name() string

func (*FortiNatPoolWrapper) Network

type FortiObjectSet

type FortiObjectSet struct {
	// contains filtered or unexported fields
}

func NewFortiObjectSet

func NewFortiObjectSet(node *FortigateNode) *FortiObjectSet

func (*FortiObjectSet) GetObjectByNetworkGroup

func (fortiGate *FortiObjectSet) GetObjectByNetworkGroup(ng *network.NetworkGroup, searchType firewall.ObjectSearchType) (firewall.FirewallNetworkObject, bool)

func (*FortiObjectSet) GetObjectByService

func (fortiGate *FortiObjectSet) GetObjectByService(ng *service.Service, searchType firewall.ObjectSearchType) (firewall.FirewallServiceObject, bool)

func (*FortiObjectSet) Network

func (fortiGate *FortiObjectSet) Network(zone, name string) (*network.NetworkGroup, bool)

func (*FortiObjectSet) Service

func (fortiGate *FortiObjectSet) Service(name string) (*service.Service, bool)

type FortiPoolSet

type FortiPoolSet struct{}

type FortigateNatStatus

type FortigateNatStatus int

type FortigateNode

type FortigateNode struct {
	// firewall.FirewallNode
	// api.Node
	*node.DeviceNode
	// contains filtered or unexported fields
}

func (*FortigateNode) AclIterator

func (node *FortigateNode) AclIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

func (*FortigateNode) AddIPsToGroup

func (fgn *FortigateNode) AddIPsToGroup(
	listType string,
	groupName string,
	ips []string,
) (string, error)

AddIPsToGroup 添加IP到预设地址组(策略方式)

func (*FortigateNode) AddIPsViaAPI

func (fgn *FortigateNode) AddIPsViaAPI(
	listType string,
	ips []string,
) (map[string]interface{}, error)

AddIPsViaAPI 通过API添加IP(专门功能方式)

func (*FortigateNode) CheckPresetConfig

func (fgn *FortigateNode) CheckPresetConfig(
	presetConfig *firewall.PresetConfig,
) (*firewall.PresetConfigCheckResult, error)

CheckPresetConfig 检查预设配置是否存在

func (*FortigateNode) DefaultStep

func (fgn *FortigateNode) DefaultStep(fp *firewall.FirewallProcess)

func (*FortigateNode) DetermineNatObjectType

func (fgn *FortigateNode) DetermineNatObjectType(natType string, metaData map[string]interface{}) (firewall.NatObjectType, bool)

determineNatObjectType 根据natType和metaData确定NAT对象类型 所有选择都必须基于设备支持作为前提 对于DNAT和SNAT,一定会命中一种防火墙支持的对象类型清单,同时结合metaData中的配置,最终选择一种对象类型

func (*FortigateNode) DnatIterator

func (node *FortigateNode) DnatIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

DnatIterator 实现

func (*FortigateNode) ExtraInit

func (fortigate *FortigateNode) ExtraInit(adapter api.Adapter, deviceConfig *config.DeviceConfig)

func (*FortigateNode) FlyConfig

func (fortigate *FortigateNode) FlyConfig(cli interface{})

func (*FortigateNode) FlyObjectToFlattenCli

func (fortigate *FortigateNode) FlyObjectToFlattenCli(flyObject interface{}, ctx *context.Context) string

func (*FortigateNode) GenerateVipMipSnatPoolName

func (fgn *FortigateNode) GenerateVipMipSnatPoolName(objectType string, intent *policy.Intent, metaData map[string]interface{}) string

GenerateVipMipSnatPoolName 自动生成VIP/MIP/SNAT_POOL对象名称(可选) FortiGate: 不提供自动命名,返回空字符串使用配置模板

func (*FortigateNode) GetImplementationMethod

func (fgn *FortigateNode) GetImplementationMethod() string

GetImplementationMethod 获取实现方式

func (*FortigateNode) GetObjectByNetworkGroup

func (fgn *FortigateNode) GetObjectByNetworkGroup(ng *network.NetworkGroup, searchType firewall.ObjectSearchType, port api.Port) (firewall.FirewallNetworkObject, bool)

func (*FortigateNode) GetObjectByService

func (fgn *FortigateNode) GetObjectByService(s *service.Service, searchType firewall.ObjectSearchType) (firewall.FirewallServiceObject, bool)

func (*FortigateNode) GetObjectByVipMipSnatPool

func (fgn *FortigateNode) GetObjectByVipMipSnatPool(objectType string, intent *policy.Intent) (firewall.FirewallNetworkObject, bool)

GetObjectByVipMipSnatPool 检查VIP/MIP/SNAT_POOL对象是否已存在(复用检查) FortiGate: 支持VIP/MIP(config firewall vip)和SNAT_POOL(config firewall ippool)

func (*FortigateNode) GetPolicyName

func (fgn *FortigateNode) GetPolicyName(ctx *firewall.PolicyContext) (string, error)

GetPolicyName 获取策略名称(FortiGate使用命名模板,返回空字符串)

func (*FortigateNode) GetPoolByNetworkGroup

func (fgn *FortigateNode) GetPoolByNetworkGroup(ng *network.NetworkGroup, natType firewall.NatType) (firewall.FirewallNetworkObject, bool)

func (*FortigateNode) GetReuseNatObject

func (fgn *FortigateNode) GetReuseNatObject(natType string, intent *policy.Intent, metaData map[string]interface{}) (name string, reused bool)

GetReuseNatObject 获取可重用的NAT对象名称 FortiGate:

  • DNAT: 根据dnat_object_type配置,可能使用VIP或MIP
  • SNAT: 根据snat_object_type配置,可能使用SNAT_POOL、INTERFACE或INLINE

通过natType和metaData配置来决定objectType,然后进行复用查询

func (*FortigateNode) GetSupportedNatObjectTypes

func (fgn *FortigateNode) GetSupportedNatObjectTypes(natType string) []firewall.NatObjectType

GetSupportedNatObjectTypes 获取该防火墙支持的NAT对象类型 FortiGate: DNAT支持VIP/MIP(特殊语法vip),SNAT支持SNAT_POOL(特殊语法ippool)

func (*FortigateNode) HasNatName

func (fgn *FortigateNode) HasNatName(name string) bool

func (*FortigateNode) HasObjectName

func (fgn *FortigateNode) HasObjectName(name string) bool

func (*FortigateNode) HasPolicyName

func (fgn *FortigateNode) HasPolicyName(name string) bool

func (*FortigateNode) HasPoolName

func (fgn *FortigateNode) HasPoolName(name string) bool

func (*FortigateNode) InputNat

func (fgn *FortigateNode) InputNat(intent *policy.Intent, inPort api.Port) processor.AbstractMatchResult

func (*FortigateNode) InputNatTargetCheck

func (fgn *FortigateNode) InputNatTargetCheck(intent *policy.Intent, inPort, outPort api.Port) (bool, firewall.FirewallNatRule)

func (*FortigateNode) InputPolicy

func (fgn *FortigateNode) InputPolicy(intent *policy.Intent, inPort, outPort api.Port) processor.AbstractMatchResult

func (*FortigateNode) L4Port

func (fgn *FortigateNode) L4Port(name string) (*service.L4Port, bool)

func (*FortigateNode) MakeDynamicNatCli

func (fgn *FortigateNode) MakeDynamicNatCli(from, out api.Port, intent *policy.Intent, ctx *firewall.PolicyContext) (interface{}, command.CmdList)

func (*FortigateNode) MakeInputPolicyCli

func (fgn *FortigateNode) MakeInputPolicyCli(from, out api.Port, intent *policy.Intent, ctx *firewall.PolicyContext) (interface{}, command.CmdList, []string)

func (*FortigateNode) MakeOutputPolicyCli

func (fgn *FortigateNode) MakeOutputPolicyCli(from, out api.Port, intent *policy.Intent, ctx *firewall.PolicyContext) (interface{}, command.CmdList)

func (*FortigateNode) MakeStaticNatCli

func (fgn *FortigateNode) MakeStaticNatCli(from, out api.Port, intent *policy.Intent, ctx *firewall.PolicyContext) (interface{}, command.CmdList)

func (*FortigateNode) MarshalJSON

func (fgn *FortigateNode) MarshalJSON() ([]byte, error)

MarshalJSON 实现 JSON 序列化

func (*FortigateNode) NatIterator

func (node *FortigateNode) NatIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

NatIterator 实现

func (*FortigateNode) NatPoolIterator

func (node *FortigateNode) NatPoolIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

NatPoolIterator 实现

func (*FortigateNode) Network

func (fgn *FortigateNode) Network(zone, name string) (*network.NetworkGroup, bool)

func (*FortigateNode) NetworkIterator

func (node *FortigateNode) NetworkIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

func (*FortigateNode) NextPoolId

func (fgn *FortigateNode) NextPoolId(id string) string

NextPoolId 返回下一个可用的 IP Pool ID FortiGate 使用名称而不是数字 ID,所以返回一个基于名称的 ID

func (*FortigateNode) OutputNat

func (fgn *FortigateNode) OutputNat(intent *policy.Intent, inPort, outPort api.Port) processor.AbstractMatchResult

func (*FortigateNode) OutputPolicy

func (fgn *FortigateNode) OutputPolicy(intent *policy.Intent, inPort, outPort api.Port) processor.AbstractMatchResult

func (*FortigateNode) Policies

func (fng *FortigateNode) Policies() []firewall.FirewallPolicy

func (*FortigateNode) PolicyIterator

func (node *FortigateNode) PolicyIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

func (*FortigateNode) RemoveIPsFromGroup

func (fgn *FortigateNode) RemoveIPsFromGroup(
	listType string,
	groupName string,
	ips []string,
) (string, error)

RemoveIPsFromGroup 从预设地址组移除IP(策略方式)

func (*FortigateNode) RemoveIPsViaAPI

func (fgn *FortigateNode) RemoveIPsViaAPI(
	listType string,
	ips []string,
) (map[string]interface{}, error)

RemoveIPsViaAPI 通过API移除IP(专门功能方式)

func (*FortigateNode) Service

func (fgn *FortigateNode) Service(name string) (*service.Service, bool)

func (*FortigateNode) ServiceIterator

func (node *FortigateNode) ServiceIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

func (*FortigateNode) SnatIterator

func (node *FortigateNode) SnatIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

SnatIterator 实现

func (*FortigateNode) StaticNatIterator

func (node *FortigateNode) StaticNatIterator(opts ...firewall.IteratorOption) firewall.NamerIterator

StaticNatIterator 实现

func (*FortigateNode) Type

func (*FortigateNode) TypeName

func (fgn *FortigateNode) TypeName() string

TypeName 实现 TypeInterface 接口

func (*FortigateNode) UnmarshalJSON

func (fgn *FortigateNode) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现 JSON 反序列化

func (*FortigateNode) UpdateSnatStep

func (fgn *FortigateNode) UpdateSnatStep(in, out api.Port, intent *policy.Intent, fp *firewall.FirewallProcess)

type FortigatePort

type FortigatePort struct {
	node.NodePort
}

func NewFortigatePort

func NewFortigatePort(name, tenant string, ip_list map[network.IPFamily][]string, members []api.Member) *FortigatePort

func (*FortigatePort) InAcl

func (fgp *FortigatePort) InAcl() string

func (*FortigatePort) Level

func (fgp *FortigatePort) Level() string

func (*FortigatePort) MainIpv4

func (fgp *FortigatePort) MainIpv4() string

func (*FortigatePort) MainIpv6

func (fgp *FortigatePort) MainIpv6() string

func (*FortigatePort) OutAcl

func (fgp *FortigatePort) OutAcl() string

func (*FortigatePort) TypeName

func (fgp *FortigatePort) TypeName() string

func (*FortigatePort) WithInAcl

func (fgp *FortigatePort) WithInAcl(name string) *FortigatePort

func (*FortigatePort) WithLevel

func (fgp *FortigatePort) WithLevel(level string) *FortigatePort

func (*FortigatePort) WithMainIpv4

func (fgp *FortigatePort) WithMainIpv4(ip string) *FortigatePort

func (*FortigatePort) WithMainIpv6

func (fgp *FortigatePort) WithMainIpv6(ip string) *FortigatePort

func (*FortigatePort) WithOutAcl

func (fgp *FortigatePort) WithOutAcl(name string) *FortigatePort

func (*FortigatePort) WithZone

func (fgp *FortigatePort) WithZone(name string) *FortigatePort

func (*FortigatePort) Zone

func (fgp *FortigatePort) Zone() string

type FortigateTemplates

type FortigateTemplates struct {
	*firewall.Naming
}

func NewFortigateTemplates

func NewFortigateTemplates(node firewall.FirewallNode) *FortigateTemplates

func (*FortigateTemplates) MakeIpPool

func (fot *FortigateTemplates) MakeIpPool(intent *policy.Intent, ng *network.NetworkGroup, rule name.NamingRuleType, additionName string, ctx *firewall.PolicyContext) (poolName string, cmdList *command.CliCmdList, flyObjectsMap map[string][]interface{})

func (*FortigateTemplates) MakeNetworkObj

func (fot *FortigateTemplates) MakeNetworkObj(intent *policy.Intent, ng *network.NetworkGroup, rule name.NamingRuleType, additionName string, port api.Port, ctx *firewall.PolicyContext) (objectName string, cmdList *command.CliCmdList, flyObjectsMap map[string][]interface{})

func (*FortigateTemplates) MakePolicy

func (fot *FortigateTemplates) MakePolicy(from, out api.Port, intent *policy.Intent, ctx *firewall.PolicyContext) (flyObjectsMap map[string][]interface{}, cmdList *command.CliCmdList)

func (*FortigateTemplates) MakeServiceObject

func (fot *FortigateTemplates) MakeServiceObject(intent *policy.Intent, sg *service.Service, rule name.NamingRuleType, additionName string, ctx *firewall.PolicyContext) (serviceName string, cmdList *command.CliCmdList, flyObjectsMap map[string][]interface{})

func (*FortigateTemplates) MakeVip

func (fot *FortigateTemplates) MakeVip(from, out api.Port, intent *policy.Intent, ng *network.NetworkGroup, rule name.NamingRuleType, additionName string, ctx *firewall.PolicyContext) (vipName string, cmdList *command.CliCmdList, flyObjectsMap map[string][]interface{})

type NatRule

type NatRule struct {
	// contains filtered or unexported fields
}

func (*NatRule) Cli

func (rule *NatRule) Cli() string

func (*NatRule) Extended

func (rule *NatRule) Extended() map[string]interface{}

func (*NatRule) MarshalJSON

func (nr *NatRule) MarshalJSON() ([]byte, error)

MarshalJSON 实现 JSON 序列化

func (*NatRule) Name

func (rule *NatRule) Name() string

func (*NatRule) Original

func (rule *NatRule) Original() policy.PolicyEntryInf

func (*NatRule) Translate

func (rule *NatRule) Translate() policy.PolicyEntryInf

func (*NatRule) TypeName

func (nr *NatRule) TypeName() string

TypeName 实现 TypeInterface 接口

func (*NatRule) UnmarshalJSON

func (nr *NatRule) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现 JSON 反序列化

type Nats

type Nats struct {
	VipRules     []*NatRule
	DynamicRules []*NatRule
	// contains filtered or unexported fields
}

func NewFortiNats

func NewFortiNats(node *FortigateNode) *Nats

func (*Nats) MarshalJSON

func (n *Nats) MarshalJSON() ([]byte, error)

MarshalJSON 实现 JSON 序列化

func (*Nats) TypeName

func (n *Nats) TypeName() string

TypeName 实现 TypeInterface 接口

func (*Nats) UnmarshalJSON

func (n *Nats) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现 JSON 反序列化

type NetworkIterator

type NetworkIterator struct {
	*firewall.BaseIterator
	// contains filtered or unexported fields
}

NetworkIterator 实现

type Policy

type Policy struct {
	// contains filtered or unexported fields
}

func (*Policy) Action

func (plc *Policy) Action() firewall.Action

func (*Policy) Cli

func (plc *Policy) Cli() string

func (*Policy) Description

func (plc *Policy) Description() string

func (*Policy) Extended

func (plc *Policy) Extended() map[string]interface{}

func (*Policy) FromPorts

func (plc *Policy) FromPorts() []api.Port

func (*Policy) FromZones

func (plc *Policy) FromZones() []string

func (*Policy) GetDestinationAddressObject

func (plc *Policy) GetDestinationAddressObject() (firewall.FirewallNetworkObject, bool)

GetDestinationAddressObject 获取策略使用的目标地址对象

func (*Policy) GetServiceObject

func (plc *Policy) GetServiceObject() (firewall.FirewallServiceObject, bool)

GetServiceObject 获取策略使用的服务对象

func (*Policy) GetSourceAddressObject

func (plc *Policy) GetSourceAddressObject() (firewall.FirewallNetworkObject, bool)

GetSourceAddressObject 获取策略使用的源地址对象

func (*Policy) ID

func (plc *Policy) ID() string

func (*Policy) MarshalJSON

func (p *Policy) MarshalJSON() ([]byte, error)

MarshalJSON 实现 JSON 序列化

func (*Policy) Match

func (plc *Policy) Match(pe policy.PolicyEntryInf) bool

func (*Policy) Name

func (plc *Policy) Name() string

func (*Policy) PolicyEntry

func (plc *Policy) PolicyEntry() policy.PolicyEntryInf

func (*Policy) SetPoolNames

func (plc *Policy) SetPoolNames(poolNames []string)

func (*Policy) SetUseNat

func (plc *Policy) SetUseNat(useNat bool)

func (*Policy) SetUsePool

func (plc *Policy) SetUsePool(usePool bool)

func (*Policy) ToPorts

func (plc *Policy) ToPorts() []api.Port

func (*Policy) ToZones

func (plc *Policy) ToZones() []string

func (*Policy) TypeName

func (p *Policy) TypeName() string

TypeName 实现 TypeInterface 接口

func (*Policy) UnmarshalJSON

func (p *Policy) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现 JSON 反序列化

type PolicyIterator

type PolicyIterator struct {
	*firewall.BaseIterator
	// contains filtered or unexported fields
}

PolicyIterator 实现

type PolicySet

type PolicySet struct {
	// contains filtered or unexported fields
}

func (*PolicySet) InPacket

func (ps *PolicySet) InPacket(from, to api.Port, entry policy.PolicyEntryInf) (firewall.Action, firewall.FirewallPolicy)

func (*PolicySet) MarshalJSON

func (ps *PolicySet) MarshalJSON() ([]byte, error)

MarshalJSON 实现 JSON 序列化

func (*PolicySet) Match

func (ps *PolicySet) Match(from, to string, pe policy.PolicyEntryInf) (bool, firewall.FirewallPolicy)

func (*PolicySet) OutPacket

func (ps *PolicySet) OutPacket(from, to api.Port, entry policy.PolicyEntryInf) (firewall.Action, firewall.FirewallPolicy)

func (*PolicySet) TypeName

func (ps *PolicySet) TypeName() string

TypeName 实现 TypeInterface 接口

func (*PolicySet) UnmarshalJSON

func (ps *PolicySet) UnmarshalJSON(data []byte) error

UnmarshalJSON 实现 JSON 反序列化

type Pool

type Pool struct{}

type ServiceIterator

type ServiceIterator struct {
	*firewall.BaseIterator
	// contains filtered or unexported fields
}

ServiceIterator 实现

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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