vsock: implemented DialContext
This PR simply implements a function DialContext so that a context can be used to terminate the dialing. VSOCK has lower chances to delay obtaining a response while dialing, but it can still occur.
Moreover, it is important to be supported while integrating with go-libp2p. Check github.com/balena/go-libp2p-vsock. It allows enclaves to dial remote libp2p nodes by means of relays.
@mdlayher gentle bump
I can't speak for every case around, but the same worked for AWS VSOCKs, which is definitely a sub case of the more general VSOCK support. Anyways, the context is being passed to the Connect function call that originally received an inlined context.Background() instance. It will be a matter for the Connect to honor the passed context or not.
I'm actually not sure why actions isn't running here, let me see.
I'm good with this but will want to get CI updated first. Will set a reminder.
The placeholder function for !linux platforms is missing a context parameter:
diff --git a/vsock_others.go b/vsock_others.go
index 5c1e88e..d46fb90 100644
--- a/vsock_others.go
+++ b/vsock_others.go
@@ -4,6 +4,7 @@
package vsock
import (
+ "context"
"fmt"
"net"
"os"
@@ -26,7 +27,7 @@ func (*listener) Addr() net.Addr { return nil }
func (*listener) Close() error { return errUnimplemented }
func (*listener) SetDeadline(_ time.Time) error { return errUnimplemented }
-func dial(_, _ uint32, _ *Config) (*Conn, error) { return nil, errUnimplemented }
+func dial(_ context.Context, _, _ uint32, _ *Config) (*Conn, error) { return nil, errUnimplemented }
type conn struct{}