mirror of https://github.com/v2ray/v2ray-core
fix error levels
parent
9b15e2f6f7
commit
2bf5a008f0
|
@ -219,7 +219,7 @@ func (*LocalNameServer) QueryA(domain string) <-chan *ARecord {
|
||||||
resolver := net.SystemIPResolver()
|
resolver := net.SystemIPResolver()
|
||||||
ips, err := resolver.LookupIP(domain)
|
ips, err := resolver.LookupIP(domain)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
newError("failed to lookup IPs for domain ", domain).Base(err).WriteToLog()
|
newError("failed to lookup IPs for domain ", domain).Base(err).AtWarning().WriteToLog()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ func NewAlwaysOnInboundHandler(ctx context.Context, tag string, receiverConfig *
|
||||||
}
|
}
|
||||||
for port := pr.From; port <= pr.To; port++ {
|
for port := pr.From; port <= pr.To; port++ {
|
||||||
if nl.HasNetwork(net.Network_TCP) {
|
if nl.HasNetwork(net.Network_TCP) {
|
||||||
newError("creating tcp worker on ", address, ":", port).AtDebug().WriteToLog()
|
newError("creating stream worker on ", address, ":", port).AtDebug().WriteToLog()
|
||||||
worker := &tcpWorker{
|
worker := &tcpWorker{
|
||||||
address: address,
|
address: address,
|
||||||
port: net.Port(port),
|
port: net.Port(port),
|
||||||
|
|
|
@ -28,7 +28,7 @@ func (m *Manager) AddHandler(ctx context.Context, config *proxyman.InboundHandle
|
||||||
}
|
}
|
||||||
receiverSettings, ok := rawReceiverSettings.(*proxyman.ReceiverConfig)
|
receiverSettings, ok := rawReceiverSettings.(*proxyman.ReceiverConfig)
|
||||||
if !ok {
|
if !ok {
|
||||||
return newError("not a ReceiverConfig")
|
return newError("not a ReceiverConfig").AtError()
|
||||||
}
|
}
|
||||||
proxySettings, err := config.ProxySettings.GetInstance()
|
proxySettings, err := config.ProxySettings.GetInstance()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -52,7 +52,7 @@ func (m *Manager) AddHandler(ctx context.Context, config *proxyman.InboundHandle
|
||||||
}
|
}
|
||||||
|
|
||||||
if handler == nil {
|
if handler == nil {
|
||||||
return newError("unknown allocation strategy: ", receiverSettings.AllocationStrategy.Type)
|
return newError("unknown allocation strategy: ", receiverSettings.AllocationStrategy.Type).AtError()
|
||||||
}
|
}
|
||||||
|
|
||||||
m.handlers = append(m.handlers, handler)
|
m.handlers = append(m.handlers, handler)
|
||||||
|
|
|
@ -77,7 +77,7 @@ func (w *tcpWorker) Start() error {
|
||||||
conns := make(chan internet.Connection, 16)
|
conns := make(chan internet.Connection, 16)
|
||||||
hub, err := internet.ListenTCP(ctx, w.address, w.port, conns)
|
hub, err := internet.ListenTCP(ctx, w.address, w.port, conns)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return newError("failed to listen TCP on ", w.port).Base(err)
|
return newError("failed to listen TCP on ", w.port).AtWarning().Base(err)
|
||||||
}
|
}
|
||||||
go w.handleConnections(conns)
|
go w.handleConnections(conns)
|
||||||
w.hub = hub
|
w.hub = hub
|
||||||
|
|
|
@ -94,11 +94,7 @@ func NewClient(p proxy.Outbound, dialer proxy.Dialer, m *ClientManager) (*Client
|
||||||
if err := p.Process(ctx, pipe, dialer); err != nil {
|
if err := p.Process(ctx, pipe, dialer); err != nil {
|
||||||
cancel()
|
cancel()
|
||||||
|
|
||||||
traceErr := errors.New("failed to handler mux client connection").Base(err)
|
errors.New("failed to handler mux client connection").Base(err).WriteToLog()
|
||||||
if err != io.EOF && err != context.Canceled {
|
|
||||||
traceErr = traceErr.AtWarning()
|
|
||||||
}
|
|
||||||
traceErr.WriteToLog()
|
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
@ -254,7 +250,7 @@ func (m *Client) fetchOutput() {
|
||||||
case SessionStatusKeep:
|
case SessionStatusKeep:
|
||||||
err = m.handleStatusKeep(meta, reader)
|
err = m.handleStatusKeep(meta, reader)
|
||||||
default:
|
default:
|
||||||
newError("unknown status: ", meta.SessionStatus).AtWarning().WriteToLog()
|
newError("unknown status: ", meta.SessionStatus).AtError().WriteToLog()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -308,7 +304,7 @@ type ServerWorker struct {
|
||||||
func handle(ctx context.Context, s *Session, output buf.Writer) {
|
func handle(ctx context.Context, s *Session, output buf.Writer) {
|
||||||
writer := NewResponseWriter(s.ID, output, s.transferType)
|
writer := NewResponseWriter(s.ID, output, s.transferType)
|
||||||
if err := buf.Copy(s.input, writer); err != nil {
|
if err := buf.Copy(s.input, writer); err != nil {
|
||||||
newError("session ", s.ID, " ends: ").Base(err).WriteToLog()
|
newError("session ", s.ID, " ends.").Base(err).WriteToLog()
|
||||||
}
|
}
|
||||||
writer.Close()
|
writer.Close()
|
||||||
s.Close()
|
s.Close()
|
||||||
|
@ -384,7 +380,7 @@ func (w *ServerWorker) handleFrame(ctx context.Context, reader *buf.BufferedRead
|
||||||
case SessionStatusKeep:
|
case SessionStatusKeep:
|
||||||
err = w.handleStatusKeep(meta, reader)
|
err = w.handleStatusKeep(meta, reader)
|
||||||
default:
|
default:
|
||||||
return newError("unknown status: ", meta.SessionStatus).AtWarning()
|
return newError("unknown status: ", meta.SessionStatus).AtError()
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -14,7 +14,7 @@ func ReadMetadata(reader io.Reader) (*FrameMetadata, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if metaLen > 512 {
|
if metaLen > 512 {
|
||||||
return nil, newError("invalid metalen ", metaLen).AtWarning()
|
return nil, newError("invalid metalen ", metaLen).AtError()
|
||||||
}
|
}
|
||||||
|
|
||||||
b := buf.New()
|
b := buf.New()
|
||||||
|
|
|
@ -62,7 +62,7 @@ func NewHandler(ctx context.Context, config *proxyman.OutboundHandlerConfig) (*H
|
||||||
if h.senderSettings != nil && h.senderSettings.MultiplexSettings != nil && h.senderSettings.MultiplexSettings.Enabled {
|
if h.senderSettings != nil && h.senderSettings.MultiplexSettings != nil && h.senderSettings.MultiplexSettings.Enabled {
|
||||||
config := h.senderSettings.MultiplexSettings
|
config := h.senderSettings.MultiplexSettings
|
||||||
if config.Concurrency < 1 || config.Concurrency > 1024 {
|
if config.Concurrency < 1 || config.Concurrency > 1024 {
|
||||||
return nil, newError("invalid mux concurrency: ", config.Concurrency)
|
return nil, newError("invalid mux concurrency: ", config.Concurrency).AtWarning()
|
||||||
}
|
}
|
||||||
h.mux = mux.NewClientManager(proxyHandler, h, config)
|
h.mux = mux.NewClientManager(proxyHandler, h, config)
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (internet.Conn
|
||||||
tag := h.senderSettings.ProxySettings.Tag
|
tag := h.senderSettings.ProxySettings.Tag
|
||||||
handler := h.outboundManager.GetHandler(tag)
|
handler := h.outboundManager.GetHandler(tag)
|
||||||
if handler != nil {
|
if handler != nil {
|
||||||
newError("proxying to ", tag).AtDebug().WriteToLog()
|
newError("proxying to ", tag, " for dest ", dest).AtDebug().WriteToLog()
|
||||||
ctx = proxy.ContextWithTarget(ctx, dest)
|
ctx = proxy.ContextWithTarget(ctx, dest)
|
||||||
stream := ray.NewRay(ctx)
|
stream := ray.NewRay(ctx)
|
||||||
go handler.Dispatch(ctx, stream)
|
go handler.Dispatch(ctx, stream)
|
||||||
|
|
|
@ -98,7 +98,7 @@ func (m *CachableDomainMatcher) Add(domain *Domain) error {
|
||||||
case Domain_Domain:
|
case Domain_Domain:
|
||||||
m.matchers = append(m.matchers, NewSubDomainMatcher(domain.Value))
|
m.matchers = append(m.matchers, NewSubDomainMatcher(domain.Value))
|
||||||
default:
|
default:
|
||||||
return newError("unknown domain type: ", domain.Type).AtError()
|
return newError("unknown domain type: ", domain.Type).AtWarning()
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ func cidrToCondition(cidr []*CIDR, source bool) (Condition, error) {
|
||||||
}
|
}
|
||||||
ipv6Cond.Add(matcher)
|
ipv6Cond.Add(matcher)
|
||||||
default:
|
default:
|
||||||
return nil, newError("invalid IP length").AtError()
|
return nil, newError("invalid IP length").AtWarning()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ func (rr *RoutingRule) BuildCondition() (Condition, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if conds.Len() == 0 {
|
if conds.Len() == 0 {
|
||||||
return nil, newError("this rule has no effective fields").AtError()
|
return nil, newError("this rule has no effective fields").AtWarning()
|
||||||
}
|
}
|
||||||
|
|
||||||
return conds, nil
|
return conds, nil
|
||||||
|
|
|
@ -24,7 +24,7 @@ func RegisterConfigLoader(format ConfigFormat, loader ConfigLoader) error {
|
||||||
func LoadConfig(format ConfigFormat, input io.Reader) (*Config, error) {
|
func LoadConfig(format ConfigFormat, input io.Reader) (*Config, error) {
|
||||||
loader, found := configLoaderCache[format]
|
loader, found := configLoaderCache[format]
|
||||||
if !found {
|
if !found {
|
||||||
return nil, newError(ConfigFormat_name[int32(format)], " is not loadable.")
|
return nil, newError(ConfigFormat_name[int32(format)], " is not loadable.").AtWarning()
|
||||||
}
|
}
|
||||||
return loader(input)
|
return loader(input)
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ func init() {
|
||||||
core.RegisterConfigLoader(core.ConfigFormat_JSON, func(input io.Reader) (*core.Config, error) {
|
core.RegisterConfigLoader(core.ConfigFormat_JSON, func(input io.Reader) (*core.Config, error) {
|
||||||
config, err := jsonToProto(input)
|
config, err := jsonToProto(input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, newError("failed to execute v2ctl to convert config file.").Base(err)
|
return nil, newError("failed to execute v2ctl to convert config file.").Base(err).AtWarning()
|
||||||
}
|
}
|
||||||
return config, nil
|
return config, nil
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue