gateway_windows -> chcp 437
This commit is contained in:
		
							parent
							
								
									dd4f956c58
								
							
						
					
					
						commit
						bf5ffd1c38
					
				@ -1,6 +1,6 @@
 | 
				
			|||||||
# Gopkg.toml example
 | 
					# Gopkg.toml example
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
 | 
					# Refer to https://golang.github.io/dep/docs/Gopkg.toml.html
 | 
				
			||||||
# for detailed Gopkg.toml documentation.
 | 
					# for detailed Gopkg.toml documentation.
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# required = ["github.com/user/thing/cmd/thing"]
 | 
					# required = ["github.com/user/thing/cmd/thing"]
 | 
				
			||||||
 | 
				
			|||||||
@ -1,13 +1,17 @@
 | 
				
			|||||||
package gateway
 | 
					package gateway
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import (
 | 
					import (
 | 
				
			||||||
 | 
						"log"
 | 
				
			||||||
	"net"
 | 
						"net"
 | 
				
			||||||
	"os/exec"
 | 
						"os/exec"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func DiscoverGateway() (ip net.IP, iface string, err error) {
 | 
					func DiscoverGateway() (ip net.IP, iface string, err error) {
 | 
				
			||||||
	routeCmd := exec.Command("route", "print", "0.0.0.0")
 | 
						output, err := exec.Command("cmd.exe", "/C", "chcp 437 && route print 0.0.0.0").CombinedOutput()
 | 
				
			||||||
	output, err := routeCmd.CombinedOutput()
 | 
						if err != nil {
 | 
				
			||||||
 | 
							panic(err)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						log.Println(string(output))
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return nil, "", err
 | 
							return nil, "", err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user