Skip to content

Commit

Permalink
fix: xray fragment and add loglevel for xray
Browse files Browse the repository at this point in the history
  • Loading branch information
hiddify-com committed Jul 30, 2024
1 parent aeb0c78 commit 288c87c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions option/xray.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ type XrayOutboundOptions struct {
UDPOverTCP *UDPOverTCPOptions `json:"udp_over_tcp,omitempty"`
XrayOutboundJson *map[string]any `json:"xray_outbound_raw"`
Fragment *conf.Fragment `json:"xray_fragment"`
LogLevel string `json:"xray_loglevel"`
}
8 changes: 6 additions & 2 deletions outbound/xray.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func NewXray(ctx context.Context, router adapter.Router, logger log.ContextLogge
outbounds := []map[string]any{}
if options.XrayOutboundJson != nil {
xrayconf := *options.XrayOutboundJson
if options.Fragment == nil {
if options.Fragment == nil || options.Fragment.Packets == "" {
xrayconf["sockopt"] = map[string]any{}
} else {
xrayconf["sockopt"] = map[string]any{
Expand All @@ -123,7 +123,7 @@ func NewXray(ctx context.Context, router adapter.Router, logger log.ContextLogge
outbounds = append(outbounds, xrayconf)
}

if options.Fragment != nil {
if options.Fragment != nil && options.Fragment.Packets != "" {
outbounds = append(outbounds, map[string]any{
"tag": "fragment",
"protocol": "freedom",
Expand All @@ -139,7 +139,11 @@ func NewXray(ctx context.Context, router adapter.Router, logger log.ContextLogge
},
})
}

xray := map[string]any{
"log": map[string]any{
"loglevel": options.LogLevel,
},
"inbounds": []any{
map[string]any{
"listen": "127.0.0.1",
Expand Down

0 comments on commit 288c87c

Please sign in to comment.