mirror of
				https://github.com/tailscale/tailscale.git
				synced 2025-10-31 12:13:45 +00:00 
			
		
		
		
	 e101d8396d
			
		
	
	e101d8396d
	
	
	
		
			
			Build tags have been updated to build native Apple M1 binaries, existing build
tags for ios have been changed from darwin,arm64 to ios,arm64.
With this change, running go build cmd/tailscale{,d}/tailscale{,d}.go on an Apple
machine with the new processor works and resulting binaries show the expected
architecture, e.g. tailscale: Mach-O 64-bit executable arm64.
Tested using go version go1.16beta1 darwin/arm64.
Updates #943
Signed-off-by: moncho <50428+moncho@users.noreply.github.com>
		
	
		
			
				
	
	
		
			42 lines
		
	
	
		
			1016 B
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1016 B
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Copyright (c) 2020 Tailscale Inc & AUTHORS All rights reserved.
 | |
| // Use of this source code is governed by a BSD-style
 | |
| // license that can be found in the LICENSE file.
 | |
| 
 | |
| // +build windows freebsd openbsd darwin,amd64 go1.16,darwin,arm64
 | |
| 
 | |
| package portlist
 | |
| 
 | |
| import (
 | |
| 	"fmt"
 | |
| 	"os/exec"
 | |
| 	"strings"
 | |
| )
 | |
| 
 | |
| var osHideWindow func(*exec.Cmd) // non-nil on Windows; see portlist_windows.go
 | |
| 
 | |
| // hideWindow returns c. On Windows it first sets SysProcAttr.HideWindow.
 | |
| func hideWindow(c *exec.Cmd) *exec.Cmd {
 | |
| 	if osHideWindow != nil {
 | |
| 		osHideWindow(c)
 | |
| 	}
 | |
| 	return c
 | |
| }
 | |
| 
 | |
| func listPortsNetstat(arg string) (List, error) {
 | |
| 	exe, err := exec.LookPath("netstat")
 | |
| 	if err != nil {
 | |
| 		return nil, fmt.Errorf("netstat: lookup: %v", err)
 | |
| 	}
 | |
| 	output, err := hideWindow(exec.Command(exe, arg)).Output()
 | |
| 	if err != nil {
 | |
| 		xe, ok := err.(*exec.ExitError)
 | |
| 		stderr := ""
 | |
| 		if ok {
 | |
| 			stderr = strings.TrimSpace(string(xe.Stderr))
 | |
| 		}
 | |
| 		return nil, fmt.Errorf("netstat: %v (%q)", err, stderr)
 | |
| 	}
 | |
| 
 | |
| 	return parsePortsNetstat(string(output)), nil
 | |
| }
 |