mirror of
https://github.com/Finesssee/ProxyPilot.git
synced 2026-11-19 02:17:46 +00:00
23 lines
424 B
Go
23 lines
424 B
Go
package tui
|
|
|
|
import (
|
|
"os/exec"
|
|
"runtime"
|
|
)
|
|
|
|
// openBrowser opens the specified URL in the default browser.
|
|
func openBrowser(url string) error {
|
|
var cmd *exec.Cmd
|
|
|
|
switch runtime.GOOS {
|
|
case "windows":
|
|
cmd = exec.Command("rundll32", "url.dll,FileProtocolHandler", url)
|
|
case "darwin":
|
|
cmd = exec.Command("open", url)
|
|
default: // linux, freebsd, etc.
|
|
cmd = exec.Command("xdg-open", url)
|
|
}
|
|
|
|
return cmd.Start()
|
|
}
|