mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-06 09:16:58 +08:00
Chore(engine): improve log message
This commit is contained in:
@@ -3,6 +3,7 @@ package engine
|
|||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
"github.com/xjasonlyu/tun2socks/v2/component/dialer"
|
||||||
@@ -130,17 +131,24 @@ func (e *engine) setInterface() error {
|
|||||||
if err := dialer.BindToInterface(e.Interface); err != nil {
|
if err := dialer.BindToInterface(e.Interface); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
log.Infof("[DIALER] use interface: %s", e.Interface)
|
log.Infof("[DIALER] bind to interface: %s", e.Interface)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *engine) setStats() error {
|
func (e *engine) setStats() error {
|
||||||
if e.Stats != "" {
|
if e.Stats != "" {
|
||||||
|
addr, err := net.ResolveTCPAddr("tcp", e.Stats)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
_ = stats.Start(e.Stats, e.Token)
|
if err := stats.Start(addr.String(), e.Token); err != nil {
|
||||||
|
log.Warnf("[STATS] stats start error: %v", err)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
log.Infof("[STATS] serve at: http://%s", e.Stats)
|
log.Infof("[STATS] serve at: http://%s", addr)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user