Skip to content

Commit

Permalink
Fixed Home method
Browse files Browse the repository at this point in the history
  • Loading branch information
bsrinivas8687 committed Jan 19, 2023
1 parent 8a0f823 commit 6362987
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion services/wireguard/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (w *WireGuard) PostUp() error { return nil }
func (w *WireGuard) PreDown() error { return nil }

func (w *WireGuard) PostDown() error {
cfgFilePath := filepath.Join(w.Home(), fmt.Sprintf("%s.conf", w.cfg.Name))
cfgFilePath := filepath.Join(w.home, fmt.Sprintf("%s.conf", w.cfg.Name))
if _, err := os.Stat(cfgFilePath); err != nil {
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions services/wireguard/wireguard_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (w *WireGuard) ExecFile(name string) string {

func (w *WireGuard) Up() error {
var (
cfgFilePath = filepath.Join(w.Home(), fmt.Sprintf("%s.conf", w.cfg.Name))
cfgFilePath = filepath.Join(w.home, fmt.Sprintf("%s.conf", w.cfg.Name))
cmd = exec.Command(w.ExecFile("wg-quick"), strings.Split(
fmt.Sprintf("up %s", shellescape.Quote(cfgFilePath)), " ")...)
)
Expand All @@ -46,7 +46,7 @@ func (w *WireGuard) Up() error {

func (w *WireGuard) Down() error {
var (
cfgFilePath = filepath.Join(w.Home(), fmt.Sprintf("%s.conf", w.cfg.Name))
cfgFilePath = filepath.Join(w.home, fmt.Sprintf("%s.conf", w.cfg.Name))
cmd = exec.Command(w.ExecFile("wg-quick"), strings.Split(
fmt.Sprintf("down %s", shellescape.Quote(cfgFilePath)), " ")...)
)
Expand Down
2 changes: 1 addition & 1 deletion services/wireguard/wireguard_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (w *WireGuard) ExecFile(name string) string {

func (w *WireGuard) Up() error {
var (
cfgFilePath = filepath.Join(w.Home(), fmt.Sprintf("%s.conf", w.cfg.Name))
cfgFilePath = filepath.Join(w.home, fmt.Sprintf("%s.conf", w.cfg.Name))
cmd = exec.Command(w.ExecFile("wg-quick"), strings.Split(
fmt.Sprintf("up %s", shellescape.Quote(cfgFilePath)), " ")...)
)
Expand Down
2 changes: 1 addition & 1 deletion services/wireguard/wireguard_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func (w *WireGuard) ExecFile(name string) string {

func (w *WireGuard) Up() error {
var (
cfgFilePath = filepath.Join(w.Home(), fmt.Sprintf("%s.conf", w.cfg.Name))
cfgFilePath = filepath.Join(w.home, fmt.Sprintf("%s.conf", w.cfg.Name))
cmd = exec.Command(
w.ExecFile("wireguard.exe"),
"/installtunnelservice", cfgFilePath,
Expand Down

0 comments on commit 6362987

Please sign in to comment.