mirror of
https://github.com/XTLS/Xray-core.git
synced 2025-05-01 01:44:15 +00:00
Refactor log (#3446)
* Refactor log * Add new log methods * Fix logger test * Change all logging code * Clean up pathObj * Rebase to latest main * Remove invoking method name after the dot
This commit is contained in:
parent
8320732743
commit
079d0bd8a9
291 changed files with 1837 additions and 2368 deletions
|
@ -4,6 +4,7 @@ import (
|
|||
"encoding/json"
|
||||
"strings"
|
||||
|
||||
"github.com/xtls/xray-core/common/errors"
|
||||
"github.com/xtls/xray-core/common/protocol"
|
||||
"github.com/xtls/xray-core/common/serial"
|
||||
"github.com/xtls/xray-core/common/uuid"
|
||||
|
@ -96,11 +97,11 @@ func (c *VMessInboundConfig) Build() (proto.Message, error) {
|
|||
for idx, rawData := range c.Users {
|
||||
user := new(protocol.User)
|
||||
if err := json.Unmarshal(rawData, user); err != nil {
|
||||
return nil, newError("invalid VMess user").Base(err)
|
||||
return nil, errors.New("invalid VMess user").Base(err)
|
||||
}
|
||||
account := new(VMessAccount)
|
||||
if err := json.Unmarshal(rawData, account); err != nil {
|
||||
return nil, newError("invalid VMess user").Base(err)
|
||||
return nil, errors.New("invalid VMess user").Base(err)
|
||||
}
|
||||
|
||||
u, err := uuid.ParseString(account.ID)
|
||||
|
@ -131,15 +132,15 @@ func (c *VMessOutboundConfig) Build() (proto.Message, error) {
|
|||
config := new(outbound.Config)
|
||||
|
||||
if len(c.Receivers) == 0 {
|
||||
return nil, newError("0 VMess receiver configured")
|
||||
return nil, errors.New("0 VMess receiver configured")
|
||||
}
|
||||
serverSpecs := make([]*protocol.ServerEndpoint, len(c.Receivers))
|
||||
for idx, rec := range c.Receivers {
|
||||
if len(rec.Users) == 0 {
|
||||
return nil, newError("0 user configured for VMess outbound")
|
||||
return nil, errors.New("0 user configured for VMess outbound")
|
||||
}
|
||||
if rec.Address == nil {
|
||||
return nil, newError("address is not set in VMess outbound config")
|
||||
return nil, errors.New("address is not set in VMess outbound config")
|
||||
}
|
||||
spec := &protocol.ServerEndpoint{
|
||||
Address: rec.Address.Build(),
|
||||
|
@ -148,11 +149,11 @@ func (c *VMessOutboundConfig) Build() (proto.Message, error) {
|
|||
for _, rawUser := range rec.Users {
|
||||
user := new(protocol.User)
|
||||
if err := json.Unmarshal(rawUser, user); err != nil {
|
||||
return nil, newError("invalid VMess user").Base(err)
|
||||
return nil, errors.New("invalid VMess user").Base(err)
|
||||
}
|
||||
account := new(VMessAccount)
|
||||
if err := json.Unmarshal(rawUser, account); err != nil {
|
||||
return nil, newError("invalid VMess user").Base(err)
|
||||
return nil, errors.New("invalid VMess user").Base(err)
|
||||
}
|
||||
|
||||
u, err := uuid.ParseString(account.ID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue