mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-10-31 16:22:03 +01:00 
			
		
		
		
	Instead of taking the first UPnP response we receive and using that to create port mappings, store all received UPnP responses, sort and deduplicate them, and then try all of them to obtain an external address. Updates #10602 Signed-off-by: Andrew Dunham <andrew@du.nham.ca> Change-Id: I783ccb1834834ee2a9ecbae2b16d801f2354302f
		
			
				
	
	
		
			33 lines
		
	
	
		
			593 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
		
			593 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) Tailscale Inc & AUTHORS
 | |
| // SPDX-License-Identifier: BSD-3-Clause
 | |
| 
 | |
| //go:build js
 | |
| 
 | |
| package portmapper
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| 	"net/netip"
 | |
| )
 | |
| 
 | |
| type upnpClient any
 | |
| 
 | |
| type uPnPDiscoResponse struct{}
 | |
| 
 | |
| func parseUPnPDiscoResponse([]byte) (uPnPDiscoResponse, error) {
 | |
| 	return uPnPDiscoResponse{}, nil
 | |
| }
 | |
| 
 | |
| func processUPnPResponses(metas []uPnPDiscoResponse) []uPnPDiscoResponse {
 | |
| 	return metas
 | |
| }
 | |
| 
 | |
| func (c *Client) getUPnPPortMapping(
 | |
| 	ctx context.Context,
 | |
| 	gw netip.Addr,
 | |
| 	internal netip.AddrPort,
 | |
| 	prevPort uint16,
 | |
| ) (external netip.AddrPort, ok bool) {
 | |
| 	return netip.AddrPort{}, false
 | |
| }
 |