mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +00:00
Enhance DNS and Dialer (#341)
This commit is contained in:
parent
ad1807dd99
commit
db32ce6fd9
22 changed files with 682 additions and 290 deletions
|
@ -17,6 +17,7 @@ type Instance struct {
|
|||
accessLogger log.Handler
|
||||
errorLogger log.Handler
|
||||
active bool
|
||||
dns bool
|
||||
}
|
||||
|
||||
// New creates a new log.Instance based on the given config.
|
||||
|
@ -24,6 +25,7 @@ func New(ctx context.Context, config *Config) (*Instance, error) {
|
|||
g := &Instance{
|
||||
config: config,
|
||||
active: false,
|
||||
dns: config.EnableDnsLog,
|
||||
}
|
||||
log.RegisterHandler(g)
|
||||
|
||||
|
@ -103,6 +105,10 @@ func (g *Instance) Handle(msg log.Message) {
|
|||
if g.accessLogger != nil {
|
||||
g.accessLogger.Handle(msg)
|
||||
}
|
||||
case *log.DNSLog:
|
||||
if g.dns && g.accessLogger != nil {
|
||||
g.accessLogger.Handle(msg)
|
||||
}
|
||||
case *log.GeneralMessage:
|
||||
if g.errorLogger != nil && msg.Severity <= g.config.ErrorLogLevel {
|
||||
g.errorLogger.Handle(msg)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue