mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-22 11:01:54 +00:00
safesocket: add ConnectContext
This adds a variant for Connect that takes in a context.Context which allows passing through cancellation etc by the caller. Updates tailscale/corp#18266 Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
package safesocket
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
"github.com/akutz/memconn"
|
||||
@@ -15,6 +16,6 @@ func listen(path string) (net.Listener, error) {
|
||||
return memconn.Listen("memu", memName)
|
||||
}
|
||||
|
||||
func connect(_ string) (net.Conn, error) {
|
||||
return memconn.Dial("memu", memName)
|
||||
func connect(ctx context.Context, _ string) (net.Conn, error) {
|
||||
return memconn.DialContext(ctx, "memu", memName)
|
||||
}
|
||||
|
Reference in New Issue
Block a user