Configure private networks, WireGuard VPN gateways, internet gateways, and virtual cross connects. This skill provides Go SDK examples.
Scanned 2/12/2026
Install via CLI
openskills install team-telnyx/telnyx-ext-agent-skills---
name: telnyx-networking-go
description: >-
Configure private networks, WireGuard VPN gateways, internet gateways, and
virtual cross connects. This skill provides Go SDK examples.
metadata:
author: telnyx
product: networking
language: go
---
# Telnyx Networking - Go
## Installation
```bash
go get github.com/team-telnyx/telnyx-go
```
## Setup
```go
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
client := telnyx.NewClient(
option.WithAPIKey(os.Getenv("TELNYX_API_KEY")),
)
```
All examples below assume `client` is already initialized as shown above.
## List all Regions
List all regions and the interfaces that region supports
`GET /regions`
```go
regions, err := client.Regions.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", regions.Data)
```
## List all Networks
List all Networks.
`GET /networks`
```go
page, err := client.Networks.List(context.TODO(), telnyx.NetworkListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a Network
Create a new Network.
`POST /networks`
```go
network, err := client.Networks.New(context.TODO(), telnyx.NetworkNewParams{
NetworkCreate: telnyx.NetworkCreateParam{
RecordParam: telnyx.RecordParam{
},
Name: "test network",
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", network.Data)
```
## Retrieve a Network
Retrieve a Network.
`GET /networks/{id}`
```go
network, err := client.Networks.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", network.Data)
```
## Update a Network
Update a Network.
`PATCH /networks/{id}`
```go
network, err := client.Networks.Update(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.NetworkUpdateParams{
NetworkCreate: telnyx.NetworkCreateParam{
RecordParam: telnyx.RecordParam{
},
Name: "test network",
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", network.Data)
```
## Delete a Network
Delete a Network.
`DELETE /networks/{id}`
```go
network, err := client.Networks.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", network.Data)
```
## Get Default Gateway status.
`GET /networks/{id}/default_gateway`
```go
defaultGateway, err := client.Networks.DefaultGateway.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", defaultGateway.Data)
```
## Create Default Gateway.
`POST /networks/{id}/default_gateway`
```go
defaultGateway, err := client.Networks.DefaultGateway.New(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.NetworkDefaultGatewayNewParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", defaultGateway.Data)
```
## Delete Default Gateway.
`DELETE /networks/{id}/default_gateway`
```go
defaultGateway, err := client.Networks.DefaultGateway.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", defaultGateway.Data)
```
## List all Interfaces for a Network.
`GET /networks/{id}/network_interfaces`
```go
page, err := client.Networks.ListInterfaces(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.NetworkListInterfacesParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## List all WireGuard Interfaces
List all WireGuard Interfaces.
`GET /wireguard_interfaces`
```go
page, err := client.WireguardInterfaces.List(context.TODO(), telnyx.WireguardInterfaceListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a WireGuard Interface
Create a new WireGuard Interface.
`POST /wireguard_interfaces`
```go
wireguardInterface, err := client.WireguardInterfaces.New(context.TODO(), telnyx.WireguardInterfaceNewParams{
RegionCode: "ashburn-va",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", wireguardInterface.Data)
```
## Retrieve a WireGuard Interfaces
Retrieve a WireGuard Interfaces.
`GET /wireguard_interfaces/{id}`
```go
wireguardInterface, err := client.WireguardInterfaces.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", wireguardInterface.Data)
```
## Delete a WireGuard Interface
Delete a WireGuard Interface.
`DELETE /wireguard_interfaces/{id}`
```go
wireguardInterface, err := client.WireguardInterfaces.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", wireguardInterface.Data)
```
## List all WireGuard Peers
List all WireGuard peers.
`GET /wireguard_peers`
```go
page, err := client.WireguardPeers.List(context.TODO(), telnyx.WireguardPeerListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a WireGuard Peer
Create a new WireGuard Peer.
`POST /wireguard_peers`
```go
wireguardPeer, err := client.WireguardPeers.New(context.TODO(), telnyx.WireguardPeerNewParams{
WireguardInterfaceID: "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", wireguardPeer.Data)
```
## Retrieve the WireGuard Peer
Retrieve the WireGuard peer.
`GET /wireguard_peers/{id}`
```go
wireguardPeer, err := client.WireguardPeers.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", wireguardPeer.Data)
```
## Update the WireGuard Peer
Update the WireGuard peer.
`PATCH /wireguard_peers/{id}`
```go
wireguardPeer, err := client.WireguardPeers.Update(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.WireguardPeerUpdateParams{
WireguardPeerPatch: telnyx.WireguardPeerPatchParam{
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", wireguardPeer.Data)
```
## Delete the WireGuard Peer
Delete the WireGuard peer.
`DELETE /wireguard_peers/{id}`
```go
wireguardPeer, err := client.WireguardPeers.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", wireguardPeer.Data)
```
## Retrieve Wireguard config template for Peer
`GET /wireguard_peers/{id}/config`
```go
response, err := client.WireguardPeers.GetConfig(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response)
```
## Get all Private Wireless Gateways
Get all Private Wireless Gateways belonging to the user.
`GET /private_wireless_gateways`
```go
page, err := client.PrivateWirelessGateways.List(context.TODO(), telnyx.PrivateWirelessGatewayListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a Private Wireless Gateway
Asynchronously create a Private Wireless Gateway for SIM cards for a previously created network.
`POST /private_wireless_gateways` — Required: `network_id`, `name`
```go
privateWirelessGateway, err := client.PrivateWirelessGateways.New(context.TODO(), telnyx.PrivateWirelessGatewayNewParams{
Name: "My private wireless gateway",
NetworkID: "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", privateWirelessGateway.Data)
```
## Get a Private Wireless Gateway
Retrieve information about a Private Wireless Gateway.
`GET /private_wireless_gateways/{id}`
```go
privateWirelessGateway, err := client.PrivateWirelessGateways.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", privateWirelessGateway.Data)
```
## Delete a Private Wireless Gateway
Deletes the Private Wireless Gateway.
`DELETE /private_wireless_gateways/{id}`
```go
privateWirelessGateway, err := client.PrivateWirelessGateways.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", privateWirelessGateway.Data)
```
## List all Public Internet Gateways
List all Public Internet Gateways.
`GET /public_internet_gateways`
```go
page, err := client.PublicInternetGateways.List(context.TODO(), telnyx.PublicInternetGatewayListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a Public Internet Gateway
Create a new Public Internet Gateway.
`POST /public_internet_gateways`
```go
publicInternetGateway, err := client.PublicInternetGateways.New(context.TODO(), telnyx.PublicInternetGatewayNewParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", publicInternetGateway.Data)
```
## Retrieve a Public Internet Gateway
Retrieve a Public Internet Gateway.
`GET /public_internet_gateways/{id}`
```go
publicInternetGateway, err := client.PublicInternetGateways.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", publicInternetGateway.Data)
```
## Delete a Public Internet Gateway
Delete a Public Internet Gateway.
`DELETE /public_internet_gateways/{id}`
```go
publicInternetGateway, err := client.PublicInternetGateways.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", publicInternetGateway.Data)
```
## List all Virtual Cross Connects
List all Virtual Cross Connects.
`GET /virtual_cross_connects`
```go
page, err := client.VirtualCrossConnects.List(context.TODO(), telnyx.VirtualCrossConnectListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a Virtual Cross Connect
Create a new Virtual Cross Connect.<br /><br />For AWS and GCE, you have the option of creating the primary connection first and the secondary connection later.
`POST /virtual_cross_connects`
```go
virtualCrossConnect, err := client.VirtualCrossConnects.New(context.TODO(), telnyx.VirtualCrossConnectNewParams{
RegionCode: "ashburn-va",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", virtualCrossConnect.Data)
```
## Retrieve a Virtual Cross Connect
Retrieve a Virtual Cross Connect.
`GET /virtual_cross_connects/{id}`
```go
virtualCrossConnect, err := client.VirtualCrossConnects.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", virtualCrossConnect.Data)
```
## Update the Virtual Cross Connect
Update the Virtual Cross Connect.<br /><br />Cloud IPs can only be patched during the `created` state, as GCE will only inform you of your generated IP once the pending connection requested has bee...
`PATCH /virtual_cross_connects/{id}`
```go
virtualCrossConnect, err := client.VirtualCrossConnects.Update(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.VirtualCrossConnectUpdateParams{
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", virtualCrossConnect.Data)
```
## Delete a Virtual Cross Connect
Delete a Virtual Cross Connect.
`DELETE /virtual_cross_connects/{id}`
```go
virtualCrossConnect, err := client.VirtualCrossConnects.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", virtualCrossConnect.Data)
```
## List Virtual Cross Connect Cloud Coverage
List Virtual Cross Connects Cloud Coverage.<br /><br />This endpoint shows which cloud regions are available for the `location_code` your Virtual Cross Connect will be provisioned in.
`GET /virtual_cross_connects/coverage`
```go
page, err := client.VirtualCrossConnectsCoverage.List(context.TODO(), telnyx.VirtualCrossConnectsCoverageListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## List all Global IPs
List all Global IPs.
`GET /global_ips`
```go
page, err := client.GlobalIPs.List(context.TODO(), telnyx.GlobalIPListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a Global IP
Create a Global IP.
`POST /global_ips`
```go
globalIP, err := client.GlobalIPs.New(context.TODO(), telnyx.GlobalIPNewParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIP.Data)
```
## Retrieve a Global IP
Retrieve a Global IP.
`GET /global_ips/{id}`
```go
globalIP, err := client.GlobalIPs.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIP.Data)
```
## Delete a Global IP
Delete a Global IP.
`DELETE /global_ips/{id}`
```go
globalIP, err := client.GlobalIPs.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIP.Data)
```
## List all Global IP Allowed Ports
`GET /global_ip_allowed_ports`
```go
globalIPAllowedPorts, err := client.GlobalIPAllowedPorts.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPAllowedPorts.Data)
```
## Global IP Assignment Health Check Metrics
`GET /global_ip_assignment_health`
```go
globalIPAssignmentHealth, err := client.GlobalIPAssignmentHealth.Get(context.TODO(), telnyx.GlobalIPAssignmentHealthGetParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPAssignmentHealth.Data)
```
## List all Global IP assignments
List all Global IP assignments.
`GET /global_ip_assignments`
```go
page, err := client.GlobalIPAssignments.List(context.TODO(), telnyx.GlobalIPAssignmentListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a Global IP assignment
Create a Global IP assignment.
`POST /global_ip_assignments`
```go
globalIPAssignment, err := client.GlobalIPAssignments.New(context.TODO(), telnyx.GlobalIPAssignmentNewParams{
GlobalIPAssignment: telnyx.GlobalIPAssignmentParam{
},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPAssignment.Data)
```
## Retrieve a Global IP
Retrieve a Global IP assignment.
`GET /global_ip_assignments/{id}`
```go
globalIPAssignment, err := client.GlobalIPAssignments.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPAssignment.Data)
```
## Update a Global IP assignment
Update a Global IP assignment.
`PATCH /global_ip_assignments/{id}`
```go
globalIPAssignment, err := client.GlobalIPAssignments.Update(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.GlobalIPAssignmentUpdateParams{
GlobalIPAssignmentUpdateRequest: telnyx.GlobalIPAssignmentUpdateParamsGlobalIPAssignmentUpdateRequest{
GlobalIPAssignmentParam: telnyx.GlobalIPAssignmentParam{
},
},
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPAssignment.Data)
```
## Delete a Global IP assignment
Delete a Global IP assignment.
`DELETE /global_ip_assignments/{id}`
```go
globalIPAssignment, err := client.GlobalIPAssignments.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPAssignment.Data)
```
## Global IP Assignment Usage Metrics
`GET /global_ip_assignments/usage`
```go
globalIPAssignmentsUsage, err := client.GlobalIPAssignmentsUsage.Get(context.TODO(), telnyx.GlobalIPAssignmentsUsageGetParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPAssignmentsUsage.Data)
```
## List all Global IP Health check types
List all Global IP Health check types.
`GET /global_ip_health_check_types`
```go
globalIPHealthCheckTypes, err := client.GlobalIPHealthCheckTypes.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPHealthCheckTypes.Data)
```
## List all Global IP health checks
List all Global IP health checks.
`GET /global_ip_health_checks`
```go
page, err := client.GlobalIPHealthChecks.List(context.TODO(), telnyx.GlobalIPHealthCheckListParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
```
## Create a Global IP health check
Create a Global IP health check.
`POST /global_ip_health_checks`
```go
globalIPHealthCheck, err := client.GlobalIPHealthChecks.New(context.TODO(), telnyx.GlobalIPHealthCheckNewParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPHealthCheck.Data)
```
## Retrieve a Global IP health check
Retrieve a Global IP health check.
`GET /global_ip_health_checks/{id}`
```go
globalIPHealthCheck, err := client.GlobalIPHealthChecks.Get(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPHealthCheck.Data)
```
## Delete a Global IP health check
Delete a Global IP health check.
`DELETE /global_ip_health_checks/{id}`
```go
globalIPHealthCheck, err := client.GlobalIPHealthChecks.Delete(context.TODO(), "6a09cdc3-8948-47f0-aa62-74ac943d6c58")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPHealthCheck.Data)
```
## Global IP Latency Metrics
`GET /global_ip_latency`
```go
globalIPLatency, err := client.GlobalIPLatency.Get(context.TODO(), telnyx.GlobalIPLatencyGetParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPLatency.Data)
```
## List all Global IP Protocols
`GET /global_ip_protocols`
```go
globalIPProtocols, err := client.GlobalIPProtocols.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPProtocols.Data)
```
## Global IP Usage Metrics
`GET /global_ip_usage`
```go
globalIPUsage, err := client.GlobalIPUsage.Get(context.TODO(), telnyx.GlobalIPUsageGetParams{
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", globalIPUsage.Data)
```
No comments yet. Be the first to comment!