@@ -11,16 +11,65 @@ import (
1111
1212// NetworkConnector represents a network connector configuration.
1313type NetworkConnector struct {
14- ID string `json:"id,omitempty"`
15- Name string `json:"name"`
16- Description string `json:"description,omitempty"`
17- NetworkItemID string `json:"networkItemId"`
18- NetworkItemType string `json:"networkItemType"`
19- VpnRegionID string `json:"vpnRegionId"`
20- IPv4Address string `json:"ipV4Address"`
21- IPv6Address string `json:"ipV6Address"`
22- Profile string `json:"profile"`
23- ConnectionStatus string `json:"connectionStatus"`
14+ ID string `json:"id,omitempty"`
15+ Name string `json:"name"`
16+ Description string `json:"description,omitempty"`
17+ NetworkItemID string `json:"networkItemId"`
18+ NetworkItemType string `json:"networkItemType"`
19+ VpnRegionID string `json:"vpnRegionId"`
20+ IPv4Address string `json:"ipV4Address"`
21+ IPv6Address string `json:"ipV6Address"`
22+ Profile string `json:"profile"`
23+ ConnectionStatus string `json:"connectionStatus"`
24+ IPSecConfig * IPSecConfig `json:"IPSecConfig,omitempty"`
25+ TunnelingProtocol string `json:"tunnelingProtocol"`
26+ }
27+
28+ // IPSecConfig represents a network connector ipsec configuration.
29+ type IPSecConfig struct {
30+ Platform string `json:"platform,omitempty"`
31+ AuthenticationType string `json:"authenticationType,omitempty"`
32+ RemoteSitePublicIP string `json:"remoteSitePublicIp,omitempty"`
33+ PreSharedKey string `json:"preSharedKey,omitempty"`
34+ CaCertificate string `json:"caCertificate,omitempty"`
35+ PeerCertificate string `json:"peerCertificate,omitempty"`
36+ RemoteGatewayCertificate string `json:"remoteGatewayCertificate,omitempty"`
37+ PeerCertificatePrivateKey string `json:"peerCertificatePrivateKey,omitempty"`
38+ PeerCertificateKeyPassphrase string `json:"peerCertificateKeyPassphrase,omitempty"`
39+ IkeProtocol IkeProtocol `json:"ikeProtocol,omitempty"`
40+ Hostname string `json:"hostname,omitempty"`
41+ Domain string `json:"domain,omitempty"`
42+ }
43+
44+ // IkeProtocol represents an ike protocol configuration for ipsec config.
45+ type IkeProtocol struct {
46+ ProtocolVersion string `json:"protocolVersion,omitempty"`
47+ Phase1 Phase `json:"phase1,omitempty"`
48+ Phase2 Phase `json:"phase2,omitempty"`
49+ Rekey Rekey `json:"rekey,omitempty"`
50+ DeadPeerDetection DeadPeerDetection `json:"deadPeerDetection,omitempty"`
51+ StartupAction string `json:"startupAction,omitempty"`
52+ }
53+
54+ // Phase represents a phase configuration used in ipsec.
55+ type Phase struct {
56+ EncryptionAlgorithms []string `json:"encryptionAlgorithms,omitempty"`
57+ IntegrityAlgorithms []string `json:"integrityAlgorithms,omitempty"`
58+ DiffieHellmanGroups []string `json:"diffieHellmanGroups,omitempty"`
59+ LifetimeSec int `json:"lifetimeSec"`
60+ }
61+
62+ // Rekey represents a rekey configuration used in ipsec.
63+ type Rekey struct {
64+ MarginTimeSec int `json:"marginTimeSec"`
65+ FuzzPercent int `json:"fuzzPercent"`
66+ ReplayWindowSize int `json:"replayWindowSize"`
67+ }
68+
69+ // DeadPeerDetection represents a dead peer detection configuration used in ipsec.
70+ type DeadPeerDetection struct {
71+ TimeoutSec int `json:"timeoutSec,omitempty"`
72+ DeadPeerHandling string `json:"deadPeerHandling,omitempty"`
2473}
2574
2675// NetworkConnectorPageResponse represents a paginated response of network connectors.
@@ -224,60 +273,33 @@ func (c *NetworkConnectorsService) Delete(connectorID string, networkID string)
224273 return err
225274}
226275
227- // IPsecStartResponse represents the response from starting an IPsec tunnel.
228- type IPsecStartResponse struct {
229- Success bool `json:"success"`
230- Message string `json:"message,omitempty"`
231- Status string `json:"status,omitempty"`
232- }
233-
234- // IPsecStopResponse represents the response from stopping an IPsec tunnel.
235- type IPsecStopResponse struct {
236- Success bool `json:"success"`
237- Message string `json:"message,omitempty"`
238- Status string `json:"status,omitempty"`
239- }
240-
241276// StartIPsec starts an IPsec tunnel for the specified network connector.
242- func (c * NetworkConnectorsService ) StartIPsec (connectorID string ) ( * IPsecStartResponse , error ) {
277+ func (c * NetworkConnectorsService ) StartIPsec (connectorID string ) error {
243278 endpoint := fmt .Sprintf ("%s/networks/connectors/%s/ipsec/start" , c .client .GetV1Url (), connectorID )
244279 req , err := http .NewRequest (http .MethodPost , endpoint , nil )
245280 if err != nil {
246- return nil , err
247- }
248-
249- body , err := c .client .DoRequest (req )
250- if err != nil {
251- return nil , err
281+ return err
252282 }
253283
254- var response IPsecStartResponse
255- err = json .Unmarshal (body , & response )
284+ _ , err = c .client .DoRequest (req )
256285 if err != nil {
257- return nil , err
286+ return err
258287 }
259-
260- return & response , nil
288+ return nil
261289}
262290
263291// StopIPsec stops an IPsec tunnel for the specified network connector.
264- func (c * NetworkConnectorsService ) StopIPsec (connectorID string ) ( * IPsecStopResponse , error ) {
292+ func (c * NetworkConnectorsService ) StopIPsec (connectorID string ) error {
265293 endpoint := fmt .Sprintf ("%s/networks/connectors/%s/ipsec/stop" , c .client .GetV1Url (), connectorID )
266294 req , err := http .NewRequest (http .MethodPost , endpoint , nil )
267295 if err != nil {
268- return nil , err
269- }
270-
271- body , err := c .client .DoRequest (req )
272- if err != nil {
273- return nil , err
296+ return err
274297 }
275298
276- var response IPsecStopResponse
277- err = json .Unmarshal (body , & response )
299+ _ , err = c .client .DoRequest (req )
278300 if err != nil {
279- return nil , err
301+ return err
280302 }
281303
282- return & response , nil
304+ return nil
283305}
0 commit comments