Skip to content

Commit

Permalink
add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Feb 20, 2024
1 parent bc0f284 commit 69ea891
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ replace github.com/sagernet/sing-box/outbound/houtbound => ./outbound/houtbound

replace github.com/sagernet/sing-box/option => ./option

replace github.com/sagernet/wireguard-go => github.com/hiddify/wireguard-go v0.0.0-20240214142457-fadc619f4357
replace github.com/sagernet/wireguard-go => github.com/hiddify/wireguard-go v0.0.0-20240220120021-eec3cffd5aa9
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a h1:fEBsGL/sjAuJrgah5X
github.com/google/pprof v0.0.0-20231101202521-4ca4178f5c7a/go.mod h1:czg5+yv1E0ZGTi6S6vVK1mke0fV+FaUhNGcd6VRS9Ik=
github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE=
github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ=
github.com/hiddify/wireguard-go v0.0.0-20240214142457-fadc619f4357 h1:INJqz+o+vG0DqCKxVyAhpFrRPH3QyzbggmXsfCNd7+k=
github.com/hiddify/wireguard-go v0.0.0-20240214142457-fadc619f4357/go.mod h1:K4J7/npM+VAMUeUmTa2JaA02JmyheP0GpRBOUvn3ecc=
github.com/hiddify/wireguard-go v0.0.0-20240220120021-eec3cffd5aa9 h1:mBB6xdxe4N7D9hDkrfgk2xgT/derT1EWRDFvjAgDfSw=
github.com/hiddify/wireguard-go v0.0.0-20240220120021-eec3cffd5aa9/go.mod h1:rOZ103uwsrPJFBfurbhp7qviY9wYO1X6kkkWWwCfvIY=
github.com/imkira/go-observer/v2 v2.0.0-20230629064422-8e0b61f11f1b h1:1+115FqGoS8p6Iry9AYmrcWDvSveH0F7P2nX1LU00qg=
github.com/imkira/go-observer/v2 v2.0.0-20230629064422-8e0b61f11f1b/go.mod h1:XCscqBi1KKh7GcVDDAdkT/Cf6WDjnDAA1XM3nwmA0Ag=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
Expand Down
10 changes: 9 additions & 1 deletion outbound/wireguard.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,25 @@ func (w *WireGuard) Close() error {

func (w *WireGuard) InterfaceUpdated() {
w.logger.Warn("Hiddify! Wirguard! Interface updated!1")
w.device.BindUpdate()
err := w.device.BindUpdate()
if err != nil {
w.logger.Error("Hiddify! Updating wireguard interface failed", err)
}
return
}

func (w *WireGuard) onPauseUpdated(event int) {
w.logger.Warn("Hiddify! Wirguard! on Pause updated! event=", event)
switch event {

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

Expand Down
8 changes: 2 additions & 6 deletions route/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package route
import (
"context"
"errors"
"fmt"

"net"
"net/netip"
"net/url"
Expand Down Expand Up @@ -55,7 +55,7 @@ type Router struct {
dnsLogger log.ContextLogger
inboundByTag map[string]adapter.Inbound
outbounds []adapter.Outbound
sortedOutboundsByDependenciesHiddify []adapter.Outbound//hiddify
sortedOutboundsByDependenciesHiddify []adapter.Outbound //hiddify
outboundByTag map[string]adapter.Outbound
rules []adapter.Rule
defaultDetour string
Expand Down Expand Up @@ -1211,10 +1211,6 @@ func (r *Router) updateWIFIState() {
}
}
func (r *Router) SortedOutboundsByDependenciesHiddify() []adapter.Outbound { //hiddify
for i, out := range r.sortedOutboundsByDependenciesHiddify {
fmt.Printf("SSSS %d %+v", i, out)
fmt.Printf("SSSS %d %s", i, out.Tag())
}
return r.sortedOutboundsByDependenciesHiddify
}
func (r *Router) doSortOutboundsByDependencies() {
Expand Down

0 comments on commit 69ea891

Please sign in to comment.