mirror of
https://github.com/siderolabs/talos.git
synced 2025-08-25 16:41:12 +02:00
When talking to an IPv6 address for a gRPC server, enclose the IPv6 address in brackets. Also fixes backwards implementation of IPv4/IPv6 test. Fixes #983 Signed-off-by: Seán C McCord <ulexus@gmail.com>
26 lines
730 B
Go
26 lines
730 B
Go
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
package net
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"gotest.tools/assert"
|
|
)
|
|
|
|
func TestEmpty(t *testing.T) {
|
|
// added for accurate coverage estimation
|
|
//
|
|
// please remove it once any unit-test is added
|
|
// for this package
|
|
}
|
|
|
|
func TestFormatAddress(t *testing.T) {
|
|
assert.Equal(t, FormatAddress("2001:db8::1"), "[2001:db8::1]")
|
|
assert.Equal(t, FormatAddress("[2001:db8::1]"), "[2001:db8::1]")
|
|
assert.Equal(t, FormatAddress("192.168.1.1"), "192.168.1.1")
|
|
assert.Equal(t, FormatAddress("alpha.beta.gamma.com"), "alpha.beta.gamma.com")
|
|
}
|