Add service trace log

This commit is contained in:
世界 2022-04-29 13:30:29 +08:00
parent df1e1cfafd
commit 8d95ae4cff
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 4 additions and 2 deletions

View file

@ -85,7 +85,7 @@ Only available with Linux kernel > 3.7.0.`)
command.Flags().IntVar(&f.FWMark, "fwmark", 0, "Set outbound socket mark.")
command.Flags().StringVar(&f.Bypass, "bypass", "", "Set bypass country.")
command.Flags().StringVarP(&f.ConfigFile, "config", "c", "", "Use a configuration file.")
command.Flags().BoolVarP(&f.Verbose, "verbose", "v", true, "Enable verbose mode.")
command.Flags().BoolVarP(&f.Verbose, "verbose", "v", false, "Enable verbose mode.")
command.Flags().BoolVar(&f.UseSystemRNG, "use-system-rng", false, "Use system random number generator.")
command.Flags().BoolVar(&f.ReducedSaltEntropy, "reduced-salt-entropy", false, "Remapping salt to printable chars.")

View file

@ -69,7 +69,7 @@ func main() {
command.Flags().StringVarP(&f.Method, "encrypt-method", "m", "", "Set the cipher.\n\nSupported ciphers:\n\n"+strings.Join(supportedCiphers, "\n"))
command.Flags().StringVarP(&f.ConfigFile, "config", "c", "", "Use a configuration file.")
command.Flags().BoolVarP(&f.Verbose, "verbose", "v", true, "Enable verbose mode.")
command.Flags().BoolVarP(&f.Verbose, "verbose", "v", false, "Enable verbose mode.")
err := command.Execute()
if err != nil {
@ -217,6 +217,7 @@ func newServer(f *flags) (*server, error) {
func (s *server) NewConnection(ctx context.Context, conn net.Conn, metadata M.Metadata) error {
if metadata.Protocol != "shadowsocks" {
logrus.Trace("inbound raw TCP from ", metadata.Source)
return s.service.NewConnection(ctx, conn, metadata)
}
logrus.Info("inbound TCP ", conn.RemoteAddr(), " ==> ", metadata.Destination)
@ -237,6 +238,7 @@ func (s *server) NewPacketConnection(conn socks.PacketConn, metadata M.Metadata)
}
func (s *server) NewPacket(conn socks.PacketConn, buffer *buf.Buffer, metadata M.Metadata) error {
logrus.Trace("inbound raw UDP from ", metadata.Source)
return s.service.NewPacket(conn, buffer, metadata)
}