...
1 package hns
2
3
4 type PolicyType string
5
6
7 const (
8 Nat PolicyType = "NAT"
9 ACL PolicyType = "ACL"
10 PA PolicyType = "PA"
11 VLAN PolicyType = "VLAN"
12 VSID PolicyType = "VSID"
13 VNet PolicyType = "VNET"
14 L2Driver PolicyType = "L2Driver"
15 Isolation PolicyType = "Isolation"
16 QOS PolicyType = "QOS"
17 OutboundNat PolicyType = "OutBoundNAT"
18 ExternalLoadBalancer PolicyType = "ELB"
19 Route PolicyType = "ROUTE"
20 Proxy PolicyType = "PROXY"
21 )
22
23 type NatPolicy struct {
24 Type PolicyType `json:"Type"`
25 Protocol string `json:",omitempty"`
26 InternalPort uint16 `json:",omitempty"`
27 ExternalPort uint16 `json:",omitempty"`
28 ExternalPortReserved bool `json:",omitempty"`
29 }
30
31 type QosPolicy struct {
32 Type PolicyType `json:"Type"`
33 MaximumOutgoingBandwidthInBytes uint64
34 }
35
36 type IsolationPolicy struct {
37 Type PolicyType `json:"Type"`
38 VLAN uint
39 VSID uint
40 InDefaultIsolation bool
41 }
42
43 type VlanPolicy struct {
44 Type PolicyType `json:"Type"`
45 VLAN uint
46 }
47
48 type VsidPolicy struct {
49 Type PolicyType `json:"Type"`
50 VSID uint
51 }
52
53 type PaPolicy struct {
54 Type PolicyType `json:"Type"`
55 PA string `json:"PA"`
56 }
57
58 type OutboundNatPolicy struct {
59 Policy
60 VIP string `json:"VIP,omitempty"`
61 Exceptions []string `json:"ExceptionList,omitempty"`
62 Destinations []string `json:",omitempty"`
63 }
64
65 type ProxyPolicy struct {
66 Type PolicyType `json:"Type"`
67 IP string `json:",omitempty"`
68 Port string `json:",omitempty"`
69 ExceptionList []string `json:",omitempty"`
70 Destination string `json:",omitempty"`
71 OutboundNat bool `json:",omitempty"`
72 }
73
74 type ActionType string
75 type DirectionType string
76 type RuleType string
77
78 const (
79 Allow ActionType = "Allow"
80 Block ActionType = "Block"
81
82 In DirectionType = "In"
83 Out DirectionType = "Out"
84
85 Host RuleType = "Host"
86 Switch RuleType = "Switch"
87 )
88
89 type ACLPolicy struct {
90 Type PolicyType `json:"Type"`
91 Id string `json:"Id,omitempty"`
92 Protocol uint16 `json:",omitempty"`
93 Protocols string `json:"Protocols,omitempty"`
94 InternalPort uint16 `json:",omitempty"`
95 Action ActionType
96 Direction DirectionType
97 LocalAddresses string `json:",omitempty"`
98 RemoteAddresses string `json:",omitempty"`
99 LocalPorts string `json:"LocalPorts,omitempty"`
100 LocalPort uint16 `json:",omitempty"`
101 RemotePorts string `json:"RemotePorts,omitempty"`
102 RemotePort uint16 `json:",omitempty"`
103 RuleType RuleType `json:"RuleType,omitempty"`
104 Priority uint16 `json:",omitempty"`
105 ServiceName string `json:",omitempty"`
106 }
107
108 type Policy struct {
109 Type PolicyType `json:"Type"`
110 }
111
View as plain text