mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-27 13:36:57 +00:00
boxdd: Add insecure mode
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/http/httputil"
|
||||
"net/netip"
|
||||
"net/url"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/sagernet/sing-box/adapter"
|
||||
@@ -26,6 +27,7 @@ import (
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
N "github.com/sagernet/sing/common/network"
|
||||
"github.com/sagernet/sing/service"
|
||||
"github.com/sagernet/sing/service/filemanager"
|
||||
)
|
||||
|
||||
func RegisterInbound(registry *inbound.Registry) {
|
||||
@@ -73,7 +75,12 @@ func NewInbound(ctx context.Context, router adapter.Router, logger log.ContextLo
|
||||
if options.Masquerade != nil && options.Masquerade.Type != "" {
|
||||
switch options.Masquerade.Type {
|
||||
case C.Hysterai2MasqueradeTypeFile:
|
||||
masqueradeHandler = http.FileServer(http.Dir(options.Masquerade.FileOptions.Directory))
|
||||
masqueradeDirectory := filemanager.BasePath(ctx, os.ExpandEnv(options.Masquerade.FileOptions.Directory))
|
||||
_, err = filemanager.ReadDir(ctx, masqueradeDirectory)
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
return nil, E.Cause(err, "read masquerade directory")
|
||||
}
|
||||
masqueradeHandler = http.FileServer(http.Dir(masqueradeDirectory))
|
||||
case C.Hysterai2MasqueradeTypeProxy:
|
||||
masqueradeURL, err := url.Parse(options.Masquerade.ProxyOptions.URL)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user