Skip to content

Commit

Permalink
make network up after it is availble
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Feb 22, 2024
1 parent 8b10558 commit ba9a88a
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions outbound/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,27 +210,27 @@ func (w *WireGuard) Close() error {
}

func (w *WireGuard) InterfaceUpdated() {
w.logger.Warn("Hiddify! Wirguard! Interface updated!1")
err := w.device.BindUpdate()
// err := fmt.Errorf("Hiddify! downing wireguard interface failed")
// w.logger.Warn("Hiddify! Wirguard! Interface updated!1")
// err := w.device.BindUpdate()
// // err := fmt.Errorf("Hiddify! downing wireguard interface failed")

if err != nil {
w.logger.Error("Hiddify! bind update failed", err)
e1 := w.device.Down()
if e1 != nil {
w.logger.Error("Hiddify! downing wireguard interface failed", e1)
}
w.logger.Warn("Hiddify! uping.... wireguard interface")
e2 := w.device.Up()
if e2 != nil {
w.logger.Error("Hiddify! Uping wireguard interface failed", e2)
} else {
w.logger.Warn("Hiddify! OK!Updating wireguard interface")
// if err != nil {
// w.logger.Error("Hiddify! bind update failed", err)
// e1 := w.device.Down()
// if e1 != nil {
// w.logger.Error("Hiddify! downing wireguard interface failed", e1)
// }
// w.logger.Warn("Hiddify! uping.... wireguard interface")
// e2 := w.device.Up()
// if e2 != nil {
// w.logger.Error("Hiddify! Uping wireguard interface failed", e2)
// } else {
// w.logger.Warn("Hiddify! OK!Updating wireguard interface")

}
} else {
w.logger.Warn("Hiddify! OK2!Updating wireguard interface")
}
// }
// } else {
// w.logger.Warn("Hiddify! OK2!Updating wireguard interface")
// }
return
}

Expand All @@ -240,12 +240,12 @@ func (w *WireGuard) onPauseUpdated(event int) {

case pause.EventDevicePaused:
w.device.Down()
// case EventNetworkPause://hiddify already handled in Interface Updated
// w.device.Down()
case EventNetworkPause: //hiddify already handled in Interface Updated

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (freebsd-386, freebsd, 386)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-mipsel-hardfloat, linux, mipsle, hardfloat)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-armv5, linux, arm, 5)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-armv6, linux, arm, 6)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (darwin-amd64, darwin, amd64, v1)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (darwin-arm64, darwin, arm64)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-mipsel-softfloat, linux, mipsle, softfloat)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (freebsd-amd64, freebsd, amd64, v1)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (freebsd-arm64, freebsd, arm64)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-mips64el, linux, mips64le)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-mips64, linux, mips64)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-armv7, linux, arm, 7)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (freebsd-amd64-v3, freebsd, amd64, v3)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-386, linux, 386)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-arm64, linux, arm64)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-amd64-v3, linux, amd64, v3)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (linux-amd64, linux, amd64, v1)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / cross (darwin-amd64-v3, darwin, amd64, v3)

undefined: EventNetworkPause

Check failure on line 243 in outbound/wireguard.go

View workflow job for this annotation

GitHub Actions / Debug build (Go 1.20)

undefined: EventNetworkPause
w.device.Down()
case pause.EventDeviceWake:
w.device.Up()
// case pause.EventNetworkWake://hiddify already handled in Interface Updated
// w.device.Up()
case pause.EventNetworkWake: //hiddify already handled in Interface Updated
w.device.Up()
}
}

Expand Down

0 comments on commit ba9a88a

Please sign in to comment.