mirror of
https://github.com/masterking32/MasterHttpRelayVPN.git
synced 2026-05-17 21:24:37 +03:00
Update logs.
This commit is contained in:
@@ -26,6 +26,8 @@ func main() {
|
||||
logger.Fatalf("<red>load config: <cyan>%v</cyan></red>", err)
|
||||
}
|
||||
|
||||
logger = lg.New("MasterHttpRelayVPN Client", cfg.LogLevel)
|
||||
|
||||
app := client.New(cfg, logger)
|
||||
|
||||
ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt, syscall.SIGTERM)
|
||||
|
||||
@@ -258,7 +258,7 @@ func (c *Client) captureInitialPayload(ctx context.Context, conn net.Conn, sessi
|
||||
session.InitialPayload = append([]byte(nil), buf[:n]...)
|
||||
session.BytesCaptured += n
|
||||
session.LastActivityAt = time.Now()
|
||||
c.log.Infof(
|
||||
c.log.Debugf(
|
||||
"<green>session=<cyan>%d</cyan> captured initial payload bytes=<cyan>%d</cyan> target=<cyan>%s</cyan></green>",
|
||||
session.ID, n, net.JoinHostPort(session.TargetHost, strconv.Itoa(int(session.TargetPort))),
|
||||
)
|
||||
|
||||
@@ -22,12 +22,14 @@ type Config struct {
|
||||
SOCKSAuth bool
|
||||
SOCKSUsername string
|
||||
SOCKSPassword string
|
||||
LogLevel string
|
||||
}
|
||||
|
||||
func Load(path string) (Config, error) {
|
||||
cfg := Config{
|
||||
SOCKSHost: "127.0.0.1",
|
||||
SOCKSPort: 1080,
|
||||
LogLevel: "INFO",
|
||||
}
|
||||
|
||||
file, err := os.Open(path)
|
||||
@@ -72,6 +74,8 @@ func Load(path string) (Config, error) {
|
||||
cfg.SOCKSUsername = trimString(value)
|
||||
case "SOCKS_PASSWORD":
|
||||
cfg.SOCKSPassword = trimString(value)
|
||||
case "LOG_LEVEL":
|
||||
cfg.LogLevel = trimString(value)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user