mirror of
https://github.com/containers/skopeo.git
synced 2025-07-13 14:34:44 +00:00
Use net/netip.Addr instead of net.IP
This is not really shorter, but more a matter of principle... Signed-off-by: Miloslav Trmač <mitr@redhat.com>
This commit is contained in:
parent
891ba3d4a6
commit
afa031e846
@ -154,7 +154,7 @@ func (cluster *openshiftCluster) prepareRegistryConfig(c *check.C) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// startRegistry starts the OpenShift registry with configPart on port, waits for it to be ready, and returns the process object, or terminates on failure.
|
// startRegistry starts the OpenShift registry with configPart on port, waits for it to be ready, and returns the process object, or terminates on failure.
|
||||||
func (cluster *openshiftCluster) startRegistryProcess(c *check.C, port int, configPath string) *exec.Cmd {
|
func (cluster *openshiftCluster) startRegistryProcess(c *check.C, port uint16, configPath string) *exec.Cmd {
|
||||||
cmd := cluster.clusterCmd(map[string]string{
|
cmd := cluster.clusterCmd(map[string]string{
|
||||||
"KUBECONFIG": "openshift.local.registry/openshift-registry.kubeconfig",
|
"KUBECONFIG": "openshift.local.registry/openshift-registry.kubeconfig",
|
||||||
"DOCKER_REGISTRY_URL": fmt.Sprintf("127.0.0.1:%d", port),
|
"DOCKER_REGISTRY_URL": fmt.Sprintf("127.0.0.1:%d", port),
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
"net/netip"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@ -105,8 +106,9 @@ func runExecCmdWithInput(c *check.C, cmd *exec.Cmd, input string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// isPortOpen returns true iff the specified port on localhost is open.
|
// isPortOpen returns true iff the specified port on localhost is open.
|
||||||
func isPortOpen(port int) bool {
|
func isPortOpen(port uint16) bool {
|
||||||
conn, err := net.DialTCP("tcp", nil, &net.TCPAddr{IP: net.IPv4(127, 0, 0, 1), Port: port})
|
ap := netip.AddrPortFrom(netip.AddrFrom4([4]byte{127, 0, 0, 1}), port)
|
||||||
|
conn, err := net.DialTCP("tcp", nil, net.TCPAddrFromAddrPort(ap))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
@ -118,7 +120,7 @@ func isPortOpen(port int) bool {
|
|||||||
// The checking can be aborted by sending a value to the terminate channel, which the caller should
|
// The checking can be aborted by sending a value to the terminate channel, which the caller should
|
||||||
// always do using
|
// always do using
|
||||||
// defer func() {terminate <- true}()
|
// defer func() {terminate <- true}()
|
||||||
func newPortChecker(c *check.C, port int) (portOpen <-chan bool, terminate chan<- bool) {
|
func newPortChecker(c *check.C, port uint16) (portOpen <-chan bool, terminate chan<- bool) {
|
||||||
portOpenBidi := make(chan bool)
|
portOpenBidi := make(chan bool)
|
||||||
// Buffered, so that sending a terminate request after the goroutine has exited does not block.
|
// Buffered, so that sending a terminate request after the goroutine has exited does not block.
|
||||||
terminateBidi := make(chan bool, 1)
|
terminateBidi := make(chan bool, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user