Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions hcn/hcnpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ type SubnetPolicy struct {
type NatFlags uint32

const (
NatFlagsNone NatFlags = iota
NatFlagsNone NatFlags = iota
NatFlagsLocalRoutedVip
NatFlagsIPv6
)
Expand Down Expand Up @@ -161,12 +161,20 @@ type FiveTuple struct {
Priority uint16 `json:",omitempty"`
}

// ProxyExceptions exempts traffic to IpAddresses and Ports
type ProxyExceptions struct {
IpAddressExceptions []string `json:",omitempty"`
PortExceptions []string `json:",omitempty"`
}

// L4WfpProxyPolicySetting sets Layer-4 Proxy on an endpoint.
type L4WfpProxyPolicySetting struct {
InboundProxyPort string `json:",omitempty"`
OutboundProxyPort string `json:",omitempty"`
FilterTuple FiveTuple `json:",omitempty"`
UserSID string `json:",omitempty"`
InboundProxyPort string `json:",omitempty"`
OutboundProxyPort string `json:",omitempty"`
FilterTuple FiveTuple `json:",omitempty"`
UserSID string `json:",omitempty"`
InboundExceptions ProxyExceptions `json:",omitempty"`
OutboundExceptions ProxyExceptions `json:",omitempty"`
}

// PortnameEndpointPolicySetting sets the port name for an endpoint.
Expand Down
10 changes: 9 additions & 1 deletion hcn/hcnutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,12 +236,20 @@ func HcnCreateAcls() (*PolicyEndpointRequest, error) {
func HcnCreateWfpProxyPolicyRequest() (*PolicyEndpointRequest, error) {
policySetting := L4WfpProxyPolicySetting{
InboundProxyPort: "80",
OutboundProxyPort: "80",
OutboundProxyPort: "81",
FilterTuple: FiveTuple{
Protocols: "6",
RemoteAddresses: "10.0.0.4",
Priority: 8,
},
OutboundExceptions: ProxyExceptions{
IpAddressExceptions: []string{"10.0.1.12"},
PortExceptions: []string{"81"},
},
InboundExceptions: ProxyExceptions{
IpAddressExceptions: []string{"12.0.1.12"},
PortExceptions: []string{"8181"},
},
}

policyJSON, err := json.Marshal(policySetting)
Expand Down