From c6d1e2a61bd9c0cdc31b343d73af37f5ba85cbd9 Mon Sep 17 00:00:00 2001 From: Thomas Pressnell Date: Sat, 15 Jun 2019 09:04:15 +0100 Subject: [PATCH] Handle IPv6 Virtual Servers --- ltm.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ltm.go b/ltm.go index eb78ec6..6070690 100644 --- a/ltm.go +++ b/ltm.go @@ -2196,13 +2196,20 @@ func (b *BigIP) VirtualServers() (*VirtualServers, error) { func (b *BigIP) CreateVirtualServer(name, destination, mask, pool string, vlans_enabled bool, port int, translate_address, translate_port string) error { subnetMask := cidr[mask] - if strings.Contains(mask, ".") { + if strings.Contains(mask, ".") || strings.Contains(mask, ":") { subnetMask = mask } + destPort := fmt.Sprintf("%s:%d", destination, port) + + // IPv6 Destinations use a "." port delimeter + if strings.Contains(destination, ":") { + destPort = fmt.Sprintf("%s.%d", destination, port) + } + config := &VirtualServer{ Name: name, - Destination: fmt.Sprintf("%s:%d", destination, port), + Destination: destPort, Mask: subnetMask, Pool: pool, TranslateAddress: translate_address,