mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-05-02 03:02:54 -04:00
* cmd tests * deposit util tests * feature config tests * hashutil tests * htr util tests * interop tests * ip util tests
21 lines
489 B
Go
21 lines
489 B
Go
package iputils_test
|
|
|
|
import (
|
|
"regexp"
|
|
"testing"
|
|
|
|
"github.com/prysmaticlabs/prysm/shared/iputils"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
|
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
|
)
|
|
|
|
func TestExternalIPv4(t *testing.T) {
|
|
// Regular expression format for IPv4
|
|
IPv4Format := `\.\d{1,3}\.\d{1,3}\b`
|
|
test, err := iputils.ExternalIPv4()
|
|
require.NoError(t, err)
|
|
|
|
valid := regexp.MustCompile(IPv4Format)
|
|
assert.Equal(t, true, valid.MatchString(test))
|
|
}
|