Documentation ¶
Index ¶
- Constants
- Variables
- func AddDnsNATPolicyV1() (json.RawMessage, error)
- func AddNATPolicyV2(vip string, destinations []string) (hcn.EndpointPolicy, error)
- func GetHcnACLPolicy(policy Policy) (hcn.EndpointPolicy, error)
- func GetHcnEndpointPolicies(policyType CNIPolicyType, policies []Policy, epInfoData map[string]interface{}, ...) ([]hcn.EndpointPolicy, error)
- func GetHcnL4WFPProxyPolicy(policy Policy) (hcn.EndpointPolicy, error)
- func GetHcnLoopbackDSRPolicy(policy Policy) (hcn.EndpointPolicy, error)
- func GetHcnNetAdapterPolicy(networkAdapterName string) (hcn.NetworkPolicy, error)
- func GetHcnOutBoundNATPolicy(policy Policy, epInfoData map[string]interface{}) (hcn.EndpointPolicy, error)
- func GetHcnPortMappingPolicy(policy Policy) (hcn.EndpointPolicy, error)
- func GetHcnRoutePolicy(policy Policy) (hcn.EndpointPolicy, error)
- func GetOutBoundNatExceptionList(policy Policy) ([]string, error)
- func SerializeHcnSubnetVlanPolicy(vlanID uint32) ([]byte, error)
- func SerializeLoopbackDSRPolicy(policy Policy) (json.RawMessage, error)
- func SerializeNATPolicy(policy Policy) (json.RawMessage, error)
- func SerializeOutBoundNATPolicy(policy Policy, epInfoData map[string]interface{}) (json.RawMessage, error)
- func SerializePolicies(policyType CNIPolicyType, policies []Policy, epInfoData map[string]interface{}, ...) []json.RawMessage
- type CNIPolicyType
- type KVPairL4WfpProxyPolicy
- type KVPairOutBoundNAT
- type KVPairRoute
- type KVPairRoutePolicy
- type LoopbackDSR
- type NATInfo
- type Policy
Constants ¶
const ( // ProtocolTcp indicates tcp protocol id for portmapping ProtocolTcp = 6 // ProtocolUdp indicates udp protocol id for portmapping ProtocolUdp = 17 // CnetAddressSpace indicates constant for the key string CnetAddressSpace = "cnetAddressSpace" )
Variables ¶
var ValidWinVerForDnsNat bool
Functions ¶
func AddDnsNATPolicyV1 ¶
func AddDnsNATPolicyV1() (json.RawMessage, error)
AddDnsNATPolicyV1 returns serialized DNS NAT policy (json) for HNSv1
func AddNATPolicyV2 ¶
func AddNATPolicyV2(vip string, destinations []string) (hcn.EndpointPolicy, error)
AddNATPolicyV2 returns serialized endpoint policy based on vip (IP to snat to) and destination(s)
func GetHcnACLPolicy ¶
func GetHcnACLPolicy(policy Policy) (hcn.EndpointPolicy, error)
GetHcnACLPolicy returns ACL policy.
func GetHcnEndpointPolicies ¶
func GetHcnEndpointPolicies(policyType CNIPolicyType, policies []Policy, epInfoData map[string]interface{}, enableSnatForDns, enableMultiTenancy bool, natInfo []NATInfo) ([]hcn.EndpointPolicy, error)
GetHcnEndpointPolicies returns array of all endpoint policies.
func GetHcnL4WFPProxyPolicy ¶
func GetHcnL4WFPProxyPolicy(policy Policy) (hcn.EndpointPolicy, error)
GetHcnL4WFPProxyPolicy returns L4WFPProxy policy.
func GetHcnLoopbackDSRPolicy ¶
func GetHcnLoopbackDSRPolicy(policy Policy) (hcn.EndpointPolicy, error)
GetHcnLoopbackDSRPolicy policy is for pod to reach itself by cluster service IP.
func GetHcnNetAdapterPolicy ¶
func GetHcnNetAdapterPolicy(networkAdapterName string) (hcn.NetworkPolicy, error)
GetHcnNetAdapterPolicy returns network adapter name policy.
func GetHcnOutBoundNATPolicy ¶
func GetHcnOutBoundNATPolicy(policy Policy, epInfoData map[string]interface{}) (hcn.EndpointPolicy, error)
GetHcnOutBoundNATPolicy returns outBoundNAT policy.
func GetHcnPortMappingPolicy ¶
func GetHcnPortMappingPolicy(policy Policy) (hcn.EndpointPolicy, error)
GetHcnPortMappingPolicy returns port mapping policy.
func GetHcnRoutePolicy ¶
func GetHcnRoutePolicy(policy Policy) (hcn.EndpointPolicy, error)
GetHcnRoutePolicy returns Route policy.
func GetOutBoundNatExceptionList ¶
GetOutBoundNatExceptionList returns exception list for outbound nat policy
func SerializeHcnSubnetVlanPolicy ¶
SerializeHcnSubnetVlanPolicy serializes subnet policy for VLAN to json.
func SerializeLoopbackDSRPolicy ¶
func SerializeLoopbackDSRPolicy(policy Policy) (json.RawMessage, error)
func SerializeNATPolicy ¶
func SerializeNATPolicy(policy Policy) (json.RawMessage, error)
func SerializeOutBoundNATPolicy ¶
func SerializeOutBoundNATPolicy(policy Policy, epInfoData map[string]interface{}) (json.RawMessage, error)
SerializeOutBoundNATPolicy formulates OutBoundNAT policy and returns serialized json
func SerializePolicies ¶
func SerializePolicies(policyType CNIPolicyType, policies []Policy, epInfoData map[string]interface{}, enableSnatForDns, enableMultiTenancy bool) []json.RawMessage
SerializePolicies serializes policies to json.
Types ¶
type CNIPolicyType ¶
type CNIPolicyType string
const ( NetworkPolicy CNIPolicyType = "NetworkPolicy" EndpointPolicy CNIPolicyType = "EndpointPolicy" OutBoundNatPolicy CNIPolicyType = "OutBoundNAT" RoutePolicy CNIPolicyType = "ROUTE" PortMappingPolicy CNIPolicyType = "NAT" ACLPolicy CNIPolicyType = "ACL" L4WFPProxyPolicy CNIPolicyType = "L4WFPPROXY" LoopbackDSRPolicy CNIPolicyType = "LoopbackDSR" )
func GetPolicyType ¶
func GetPolicyType(policy Policy) CNIPolicyType
GetPolicyType parses the policy and returns the policy type
type KVPairL4WfpProxyPolicy ¶
type KVPairL4WfpProxyPolicy struct { Type CNIPolicyType `json:"Type"` OutboundProxyPort string `json:"OutboundProxyPort"` InboundProxyPort string `json:"InboundProxyPort"` UserSID string `json:"UserSID"` FilterTuple json.RawMessage `json:"FilterTuple"` InboundExceptions json.RawMessage `json:"InboundExceptions"` OutboundExceptions json.RawMessage `json:"OutboundExceptions"` }
type KVPairOutBoundNAT ¶
type KVPairOutBoundNAT struct { Type CNIPolicyType `json:"Type"` ExceptionList json.RawMessage `json:"ExceptionList"` }
type KVPairRoute ¶
type KVPairRoute struct { Type CNIPolicyType `json:"Type"` DestinationPrefix string `json:"DestinationPrefix"` NeedEncap bool `json:"NeedEncap"` }
type KVPairRoutePolicy ¶
type KVPairRoutePolicy struct { Type CNIPolicyType `json:"Type"` DestinationPrefix json.RawMessage `json:"DestinationPrefix"` NeedEncap json.RawMessage `json:"NeedEncap"` }
type LoopbackDSR ¶
type LoopbackDSR struct { Type CNIPolicyType `json:"Type"` IPAddress net.IP `json:"IPAddress"` }
type Policy ¶
type Policy struct { Type CNIPolicyType Data json.RawMessage }