mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-10-31 00:01:40 +01:00 
			
		
		
		
	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>
		
			
				
	
	
		
			22 lines
		
	
	
		
			403 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			403 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) Tailscale Inc & AUTHORS
 | |
| // SPDX-License-Identifier: BSD-3-Clause
 | |
| 
 | |
| package safesocket
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"net"
 | |
| 
 | |
| 	"github.com/akutz/memconn"
 | |
| )
 | |
| 
 | |
| const memName = "Tailscale-IPN"
 | |
| 
 | |
| func listen(path string) (net.Listener, error) {
 | |
| 	return memconn.Listen("memu", memName)
 | |
| }
 | |
| 
 | |
| func connect(ctx context.Context, _ string) (net.Conn, error) {
 | |
| 	return memconn.DialContext(ctx, "memu", memName)
 | |
| }
 |