Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions cmd/func-util/socat.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,9 @@ func createConnection(address string, stdio connection) (connection, error) {
switch typ {
case "tcp", "tcp4", "tcp6":
_, _ = fmt.Fprintln(os.Stderr, "opening connection")
var laddr net.TCPAddr
raddr, err := net.ResolveTCPAddr(typ, addr)
if err != nil {
return nil, fmt.Errorf("name does not resolve: %w", err)
}

conn, err := net.DialTCP(typ, &laddr, raddr)
conn, err := net.Dial(typ, addr)
if err == nil {
_, _ = fmt.Fprintf(os.Stderr, "successfully connected to %v\n", raddr)
_, _ = fmt.Fprintf(os.Stderr, "successfully connected to %v\n", conn.RemoteAddr())
}
return conn, err
case "open":
Expand Down
2 changes: 1 addition & 1 deletion cmd/func-util/socat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func TestRootCmd(t *testing.T) {
args: args{
args: []string{"-", "TCP:does.not.exist:10000"},
inputString: "tcp-echo",
errOutMatcher: contains("not resolve"),
errOutMatcher: contains("no such host"),
wantErr: true,
},
},
Expand Down
Loading