Compare commits

..

1 Commits

Author SHA1 Message Date
世界
f48f8c5d1c Add daemon support 2022-08-25 11:07:41 +08:00
220 changed files with 4669 additions and 4569 deletions

View File

@@ -1,5 +1,6 @@
name: Bug Report name: Bug Report
description: "Create a report to help us improve." description: "Create a report to help us improve."
labels: [ bug ]
body: body:
- type: checkboxes - type: checkboxes
id: terms id: terms
@@ -31,7 +32,7 @@ body:
<details> <details>
```console ```console
$ sing-box version $ sing-box --version
# Paste output here # Paste output here
``` ```
@@ -55,7 +56,7 @@ body:
required: true required: true
- type: textarea - type: textarea
id: log id: config
attributes: attributes:
label: Server and client log file label: Server and client log file
value: |- value: |-

View File

@@ -1,5 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
PROJECTS=$(dirname "$0")/../.. PROJECTS=$(dirname "$0")/../..
go get -x github.com/sagernet/$1@$(git -C $PROJECTS/$1 rev-parse HEAD)
go get -x github.com/sagernet/sing@$(git -C $PROJECTS/sing rev-parse HEAD)
go get -x github.com/sagernet/sing-dns@$(git -C $PROJECTS/sing-dns rev-parse HEAD)
go get -x github.com/sagernet/sing-tun@$(git -C $PROJECTS/sing-tun rev-parse HEAD)
go get -x github.com/sagernet/sing-shadowsocks@$(git -C $PROJECTS/sing-shadowsocks rev-parse HEAD)
go get -x github.com/sagernet/sing-vmess@$(git -C $PROJECTS/sing-vmess rev-parse HEAD)
go mod tidy go mod tidy

View File

@@ -3,18 +3,14 @@ name: Debug build
on: on:
push: push:
branches: branches:
- main
- dev - dev
- dev-next
paths-ignore: paths-ignore:
- '**.md' - '**.md'
- '.github/**' - '.github/**'
- '!.github/workflows/debug.yml' - '!.github/workflows/debug.yml'
pull_request: pull_request:
branches: branches:
- main
- dev - dev
- dev-next
jobs: jobs:
build: build:

View File

@@ -1,43 +0,0 @@
name: Build Docker Images
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
tag:
description: "The tag version you want to build"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Docker metadata
id: metadata
uses: docker/metadata-action@v3
with:
images: ghcr.io/sagernet/sing-box
- name: Get tag to build
id: tag
run: |
if [[ -z "${{ github.event.inputs.tag }}" ]]; then
echo ::set-output name=tag::ghcr.io/sagernet/sing-box:${{ github.ref_name }}
else
echo ::set-output name=tag::ghcr.io/sagernet/sing-box:${{ github.event.inputs.tag }}
fi
- name: Build and release Docker images
uses: docker/build-push-action@v2
with:
platforms: linux/386,linux/amd64
target: dist
tags: ${{ steps.tag.outputs.tag }}
push: true

View File

@@ -13,13 +13,11 @@ builds:
tags: tags:
- with_quic - with_quic
- with_wireguard - with_wireguard
- with_acme
- with_clash_api - with_clash_api
env: env:
- CGO_ENABLED=0 - CGO_ENABLED=0
targets: targets:
- android_arm64
- android_amd64
- android_amd64_v3
- linux_amd64_v1 - linux_amd64_v1
- linux_amd64_v3 - linux_amd64_v3
- linux_arm64 - linux_arm64

View File

@@ -1,23 +0,0 @@
FROM golang:1.19-alpine AS builder
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
COPY . /go/src/github.com/sagernet/sing-box
WORKDIR /go/src/github.com/sagernet/sing-box
ARG GOPROXY=""
ENV GOPROXY ${GOPROXY}
ENV CGO_ENABLED=0
RUN set -ex \
&& apk add git build-base \
&& export COMMIT=$(git rev-parse --short HEAD) \
&& go build -v -trimpath -tags 'no_gvisor,with_quic,with_wireguard,with_acme' \
-o /go/bin/sing-box \
-ldflags "-X github.com/sagernet/sing-box/constant.Commit=${COMMIT} -w -s -buildid=" \
./cmd/sing-box
FROM alpine AS dist
LABEL maintainer="nekohasekai <contact-git@sekai.icu>"
RUN [ ! -e /etc/nsswitch.conf ] && echo 'hosts: files dns' > /etc/nsswitch.conf
RUN set -ex \
&& apk upgrade \
&& apk add bash tzdata ca-certificates \
&& rm -rf /var/cache/apk/*
COPY --from=builder /go/bin/sing-box /usr/local/bin/sing-box
ENTRYPOINT ["sing-box"]

View File

@@ -1,6 +1,6 @@
NAME = sing-box NAME = sing-box
COMMIT = $(shell git rev-parse --short HEAD) COMMIT = $(shell git rev-parse --short HEAD)
TAGS ?= with_quic,with_wireguard,with_clash_api TAGS ?= with_quic,with_wireguard,with_clash_api,with_daemon
PARAMS = -v -trimpath -tags '$(TAGS)' -ldflags \ PARAMS = -v -trimpath -tags '$(TAGS)' -ldflags \
'-X "github.com/sagernet/sing-box/constant.Commit=$(COMMIT)" \ '-X "github.com/sagernet/sing-box/constant.Commit=$(COMMIT)" \
-w -s -buildid=' -w -s -buildid='
@@ -49,14 +49,7 @@ snapshot:
ghr --delete --draft --prerelease -p 1 nightly dist/release ghr --delete --draft --prerelease -p 1 nightly dist/release
rm -r dist rm -r dist
release: snapshot_install:
goreleaser release --rm-dist --skip-publish
mkdir dist/release
mv dist/*.tar.gz dist/*.zip dist/*.deb dist/*.rpm dist/release
ghr --delete --draft --prerelease -p 3 $(shell git describe --tags) dist/release
rm -r dist
release_install:
go install -v github.com/goreleaser/goreleaser@latest go install -v github.com/goreleaser/goreleaser@latest
go install -v github.com/tcnksm/ghr@latest go install -v github.com/tcnksm/ghr@latest

View File

@@ -2,13 +2,11 @@ package adapter
import ( import (
"context" "context"
"net"
"net/netip" "net/netip"
"github.com/sagernet/sing-box/common/process" "github.com/sagernet/sing-box/common/process"
"github.com/sagernet/sing-dns" "github.com/sagernet/sing-dns"
M "github.com/sagernet/sing/common/metadata" M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network"
) )
type Inbound interface { type Inbound interface {
@@ -17,13 +15,6 @@ type Inbound interface {
Tag() string Tag() string
} }
type InjectableInbound interface {
Inbound
Network() []string
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
}
type InboundContext struct { type InboundContext struct {
Inbound string Inbound string
InboundType string InboundType string
@@ -38,8 +29,6 @@ type InboundContext struct {
// cache // cache
InboundDetour string
LastInbound string
OriginDestination M.Socksaddr OriginDestination M.Socksaddr
DomainStrategy dns.DomainStrategy DomainStrategy dns.DomainStrategy
SniffEnabled bool SniffEnabled bool

2
box.go
View File

@@ -138,7 +138,7 @@ func New(ctx context.Context, options option.Options) (*Box, error) {
} }
outbounds = append(outbounds, out) outbounds = append(outbounds, out)
} }
err = router.Initialize(inbounds, outbounds, func() adapter.Outbound { err = router.Initialize(outbounds, func() adapter.Outbound {
out, oErr := outbound.New(ctx, router, logFactory.NewLogger("outbound/direct"), option.Outbound{Type: "direct", Tag: "default"}) out, oErr := outbound.New(ctx, router, logFactory.NewLogger("outbound/direct"), option.Outbound{Type: "direct", Tag: "default"})
common.Must(oErr) common.Must(oErr)
outbounds = append(outbounds, out) outbounds = append(outbounds, out)

272
cmd/sing-box/cmd_daemon.go Normal file
View File

@@ -0,0 +1,272 @@
//go:build with_daemon
package main
import (
"bytes"
"io"
"net"
"net/http"
"net/url"
"os"
"github.com/sagernet/sing-box/common/json"
"github.com/sagernet/sing-box/experimental/daemon"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing/common"
E "github.com/sagernet/sing/common/exceptions"
F "github.com/sagernet/sing/common/format"
"github.com/spf13/cobra"
)
var commandDaemon = &cobra.Command{
Use: "daemon",
}
func init() {
commandDaemon.AddCommand(commandDaemonInstall)
commandDaemon.AddCommand(commandDaemonUninstall)
commandDaemon.AddCommand(commandDaemonStart)
commandDaemon.AddCommand(commandDaemonStop)
commandDaemon.AddCommand(commandDaemonRestart)
commandDaemon.AddCommand(commandDaemonRun)
mainCommand.AddCommand(commandDaemon)
mainCommand.AddCommand(commandStart)
mainCommand.AddCommand(commandStop)
mainCommand.AddCommand(commandStatus)
}
var commandDaemonInstall = &cobra.Command{
Use: "install",
Short: "Install daemon",
Run: func(cmd *cobra.Command, args []string) {
err := installDaemon()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
var commandDaemonUninstall = &cobra.Command{
Use: "uninstall",
Short: "Uninstall daemon",
Run: func(cmd *cobra.Command, args []string) {
err := uninstallDaemon()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
var commandDaemonStart = &cobra.Command{
Use: "start",
Short: "Start daemon",
Run: func(cmd *cobra.Command, args []string) {
err := startDaemon()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
var commandDaemonStop = &cobra.Command{
Use: "stop",
Short: "Stop daemon",
Run: func(cmd *cobra.Command, args []string) {
err := stopDaemon()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
var commandDaemonRestart = &cobra.Command{
Use: "restart",
Short: "Restart daemon",
Run: func(cmd *cobra.Command, args []string) {
err := restartDaemon()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
var commandDaemonRun = &cobra.Command{
Use: "run",
Short: "Run daemon",
Run: func(cmd *cobra.Command, args []string) {
err := runDaemon()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
func installDaemon() error {
instance, err := daemon.New()
if err != nil {
return err
}
return instance.Install()
}
func uninstallDaemon() error {
instance, err := daemon.New()
if err != nil {
return err
}
return instance.Uninstall()
}
func startDaemon() error {
instance, err := daemon.New()
if err != nil {
return err
}
return instance.Start()
}
func stopDaemon() error {
instance, err := daemon.New()
if err != nil {
return err
}
return instance.Stop()
}
func restartDaemon() error {
instance, err := daemon.New()
if err != nil {
return err
}
return instance.Restart()
}
func runDaemon() error {
instance, err := daemon.New()
if err != nil {
return err
}
return instance.Run()
}
var commandStart = &cobra.Command{
Use: "start",
Short: "Start service",
Run: func(cmd *cobra.Command, args []string) {
err := startService()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
var commandStop = &cobra.Command{
Use: "stop",
Short: "Stop service",
Run: func(cmd *cobra.Command, args []string) {
err := stopService()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
var commandStatus = &cobra.Command{
Use: "status",
Short: "Check service",
Run: func(cmd *cobra.Command, args []string) {
err := checkService()
if err != nil {
log.Fatal(err)
}
},
Args: cobra.NoArgs,
}
func doRequest(method string, path string, params url.Values, body io.ReadCloser) ([]byte, error) {
requestURL := url.URL{
Scheme: "http",
Path: path,
Host: net.JoinHostPort("127.0.0.1", F.ToString(daemon.DefaultDaemonPort)),
}
if params != nil {
requestURL.RawQuery = params.Encode()
}
request, err := http.NewRequest(method, requestURL.String(), body)
if err != nil {
return nil, err
}
response, err := http.DefaultClient.Do(request)
if err != nil {
return nil, err
}
defer response.Body.Close()
var content []byte
if response.StatusCode != http.StatusNoContent {
content, err = io.ReadAll(response.Body)
if err != nil {
return nil, err
}
}
if response.StatusCode != http.StatusOK && response.StatusCode != http.StatusNoContent {
return nil, E.New(string(content))
}
return content, nil
}
func ping() error {
response, err := doRequest("GET", "/ping", nil, nil)
if err != nil || string(response) != "pong" {
return E.New("daemon not running")
}
return nil
}
func startService() error {
if err := ping(); err != nil {
return err
}
configContent, err := os.ReadFile(configPath)
if err != nil {
return E.Cause(err, "read config")
}
return common.Error(doRequest("POST", "/run", nil, io.NopCloser(bytes.NewReader(configContent))))
}
func stopService() error {
if err := ping(); err != nil {
return err
}
return common.Error(doRequest("GET", "/stop", nil, nil))
}
func checkService() error {
if err := ping(); err != nil {
return err
}
response, err := doRequest("GET", "/status", nil, nil)
if err != nil {
return err
}
var statusResponse daemon.StatusResponse
err = json.Unmarshal(response, &statusResponse)
if err != nil {
return err
}
if statusResponse.Running {
log.Info("service running")
} else {
log.Info("service stopped")
}
return nil
}

View File

@@ -38,7 +38,7 @@ func format() error {
return E.Cause(err, "read config") return E.Cause(err, "read config")
} }
var options option.Options var options option.Options
err = options.UnmarshalJSON(configContent) err = json.Unmarshal(configContent, &options)
if err != nil { if err != nil {
return E.Cause(err, "decode config") return E.Cause(err, "decode config")
} }

View File

@@ -9,6 +9,7 @@ import (
"syscall" "syscall"
"github.com/sagernet/sing-box" "github.com/sagernet/sing-box"
"github.com/sagernet/sing-box/common/json"
"github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option" "github.com/sagernet/sing-box/option"
E "github.com/sagernet/sing/common/exceptions" E "github.com/sagernet/sing/common/exceptions"
@@ -45,7 +46,7 @@ func readConfig() (option.Options, error) {
return option.Options{}, E.Cause(err, "read config") return option.Options{}, E.Cause(err, "read config")
} }
var options option.Options var options option.Options
err = options.UnmarshalJSON(configContent) err = json.Unmarshal(configContent, &options)
if err != nil { if err != nil {
return option.Options{}, E.Cause(err, "decode config") return option.Options{}, E.Cause(err, "decode config")
} }

View File

@@ -38,7 +38,7 @@ func printVersion(cmd *cobra.Command, args []string) {
version += runtime.Version() version += runtime.Version()
version += ", " version += ", "
version += runtime.GOOS version += runtime.GOOS
version += "/" version += ", "
version += runtime.GOARCH version += runtime.GOARCH
version += ", " version += ", "
version += "CGO " version += "CGO "

View File

@@ -1,62 +0,0 @@
package baderror
import (
"context"
"io"
"net"
"strings"
E "github.com/sagernet/sing/common/exceptions"
)
func Contains(err error, msgList ...string) bool {
for _, msg := range msgList {
if strings.Contains(err.Error(), msg) {
return true
}
}
return false
}
func WrapH2(err error) error {
if err == nil {
return nil
}
err = E.Unwrap(err)
if err == io.ErrUnexpectedEOF {
return io.EOF
}
if Contains(err, "client disconnected", "body closed by handler") {
return net.ErrClosed
}
return err
}
func WrapGRPC(err error) error {
// grpc uses stupid internal error types
if err == nil {
return nil
}
if Contains(err, "EOF") {
return io.EOF
}
if Contains(err, "Canceled") {
return context.Canceled
}
if Contains(err,
"the client connection is closing",
"server closed the stream without sending trailers") {
return net.ErrClosed
}
return err
}
func WrapQUIC(err error) error {
if err == nil {
return nil
}
if Contains(err, "canceled with error code 0") {
return net.ErrClosed
}
return err
}

19
common/dialer/bind.go Normal file
View File

@@ -0,0 +1,19 @@
package dialer
import (
"syscall"
"github.com/sagernet/sing/common/control"
M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network"
)
func skipIfPrivate(next control.Func) control.Func {
return func(network, address string, conn syscall.RawConn) error {
destination := M.ParseSocksaddr(address)
if !N.IsPublicAddr(destination.Addr) {
return nil
}
return next(network, address, conn)
}
}

View File

@@ -11,7 +11,6 @@ import (
C "github.com/sagernet/sing-box/constant" C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/option" "github.com/sagernet/sing-box/option"
"github.com/sagernet/sing/common/control" "github.com/sagernet/sing/common/control"
E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata" M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network" N "github.com/sagernet/sing/common/network"
@@ -65,25 +64,25 @@ func NewDefault(router adapter.Router, options option.DialerOptions) *DefaultDia
var listener net.ListenConfig var listener net.ListenConfig
if options.BindInterface != "" { if options.BindInterface != "" {
warnBindInterfaceOnUnsupportedPlatform.Check() warnBindInterfaceOnUnsupportedPlatform.Check()
bindFunc := control.BindToInterface(router.InterfaceBindManager(), options.BindInterface) bindFunc := skipIfPrivate(control.BindToInterface(router.InterfaceBindManager(), options.BindInterface))
dialer.Control = control.Append(dialer.Control, bindFunc) dialer.Control = control.Append(dialer.Control, bindFunc)
listener.Control = control.Append(listener.Control, bindFunc) listener.Control = control.Append(listener.Control, bindFunc)
} else if router.AutoDetectInterface() { } else if router.AutoDetectInterface() {
if C.IsWindows { if C.IsWindows {
bindFunc := control.BindToInterfaceIndexFunc(func(network, address string) int { bindFunc := skipIfPrivate(control.BindToInterfaceIndexFunc(func() int {
return router.InterfaceMonitor().DefaultInterfaceIndex(M.ParseSocksaddr(address).Addr) return router.InterfaceMonitor().DefaultInterfaceIndex()
}) }))
dialer.Control = control.Append(dialer.Control, bindFunc) dialer.Control = control.Append(dialer.Control, bindFunc)
listener.Control = control.Append(listener.Control, bindFunc) listener.Control = control.Append(listener.Control, bindFunc)
} else { } else {
bindFunc := control.BindToInterfaceFunc(router.InterfaceBindManager(), func(network, address string) string { bindFunc := skipIfPrivate(control.BindToInterfaceFunc(router.InterfaceBindManager(), func() string {
return router.InterfaceMonitor().DefaultInterfaceName(M.ParseSocksaddr(address).Addr) return router.InterfaceMonitor().DefaultInterfaceName()
}) }))
dialer.Control = control.Append(dialer.Control, bindFunc) dialer.Control = control.Append(dialer.Control, bindFunc)
listener.Control = control.Append(listener.Control, bindFunc) listener.Control = control.Append(listener.Control, bindFunc)
} }
} else if router.DefaultInterface() != "" { } else if router.DefaultInterface() != "" {
bindFunc := control.BindToInterface(router.InterfaceBindManager(), router.DefaultInterface()) bindFunc := skipIfPrivate(control.BindToInterface(router.InterfaceBindManager(), router.DefaultInterface()))
dialer.Control = control.Append(dialer.Control, bindFunc) dialer.Control = control.Append(dialer.Control, bindFunc)
listener.Control = control.Append(listener.Control, bindFunc) listener.Control = control.Append(listener.Control, bindFunc)
} }
@@ -114,10 +113,7 @@ func NewDefault(router adapter.Router, options option.DialerOptions) *DefaultDia
} }
var bindUDPAddr string var bindUDPAddr string
udpDialer := dialer udpDialer := dialer
var bindAddress netip.Addr bindAddress := netip.Addr(options.BindAddress)
if options.BindAddress != nil {
bindAddress = options.BindAddress.Build()
}
if bindAddress.IsValid() { if bindAddress.IsValid() {
dialer.LocalAddr = &net.TCPAddr{ dialer.LocalAddr = &net.TCPAddr{
IP: bindAddress.AsSlice(), IP: bindAddress.AsSlice(),
@@ -131,9 +127,6 @@ func NewDefault(router adapter.Router, options option.DialerOptions) *DefaultDia
} }
func (d *DefaultDialer) DialContext(ctx context.Context, network string, address M.Socksaddr) (net.Conn, error) { func (d *DefaultDialer) DialContext(ctx context.Context, network string, address M.Socksaddr) (net.Conn, error) {
if !address.IsValid() {
return nil, E.New("invalid address")
}
switch N.NetworkName(network) { switch N.NetworkName(network) {
case N.NetworkUDP: case N.NetworkUDP:
return d.udpDialer.DialContext(ctx, network, address.String()) return d.udpDialer.DialContext(ctx, network, address.String())

View File

@@ -10,12 +10,15 @@ import (
) )
func New(router adapter.Router, options option.DialerOptions) N.Dialer { func New(router adapter.Router, options option.DialerOptions) N.Dialer {
var dialer N.Dialer
if options.Detour == "" { if options.Detour == "" {
dialer = NewDefault(router, options) return NewDefault(router, options)
} else { } else {
dialer = NewDetour(router, options.Detour) return NewDetour(router, options.Detour)
} }
}
func NewOutbound(router adapter.Router, options option.OutboundDialerOptions) N.Dialer {
dialer := New(router, options.DialerOptions)
domainStrategy := dns.DomainStrategy(options.DomainStrategy) domainStrategy := dns.DomainStrategy(options.DomainStrategy)
if domainStrategy != dns.DomainStrategyAsIS || options.Detour == "" { if domainStrategy != dns.DomainStrategyAsIS || options.Detour == "" {
dialer = NewResolveDialer(router, dialer, domainStrategy, time.Duration(options.FallbackDelay)) dialer = NewResolveDialer(router, dialer, domainStrategy, time.Duration(options.FallbackDelay))

View File

@@ -51,7 +51,7 @@ func (d *ResolveDialer) DialContext(ctx context.Context, network string, destina
} }
func (d *ResolveDialer) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) { func (d *ResolveDialer) ListenPacket(ctx context.Context, destination M.Socksaddr) (net.PacketConn, error) {
if !destination.IsFqdn() { if !destination.IsFqdn() || destination.Fqdn == "" {
return d.dialer.ListenPacket(ctx, destination) return d.dialer.ListenPacket(ctx, destination)
} }
ctx, metadata := adapter.AppendContext(ctx) ctx, metadata := adapter.AppendContext(ctx)

View File

@@ -18,21 +18,21 @@ func NewSearcher(config Config) (Searcher, error) {
} }
func (s *androidSearcher) FindProcessInfo(ctx context.Context, network string, source netip.AddrPort, destination netip.AddrPort) (*Info, error) { func (s *androidSearcher) FindProcessInfo(ctx context.Context, network string, source netip.AddrPort, destination netip.AddrPort) (*Info, error) {
_, uid, err := resolveSocketByNetlink(network, source, destination) socket, err := resolveSocketByNetlink(network, source, destination)
if err != nil { if err != nil {
return nil, err return nil, err
} }
if sharedPackage, loaded := s.packageManager.SharedPackageByID(uid % 100000); loaded { if sharedPackage, loaded := s.packageManager.SharedPackageByID(socket.UID); loaded {
return &Info{ return &Info{
UserId: int32(uid), UserId: int32(socket.UID),
PackageName: sharedPackage, PackageName: sharedPackage,
}, nil }, nil
} }
if packageName, loaded := s.packageManager.PackageByID(uid % 100000); loaded { if packageName, loaded := s.packageManager.PackageByID(socket.UID); loaded {
return &Info{ return &Info{
UserId: int32(uid), UserId: int32(socket.UID),
PackageName: packageName, PackageName: packageName,
}, nil }, nil
} }
return &Info{UserId: int32(uid)}, nil return &Info{UserId: int32(socket.UID)}, nil
} }

View File

@@ -20,16 +20,16 @@ func NewSearcher(config Config) (Searcher, error) {
} }
func (s *linuxSearcher) FindProcessInfo(ctx context.Context, network string, source netip.AddrPort, destination netip.AddrPort) (*Info, error) { func (s *linuxSearcher) FindProcessInfo(ctx context.Context, network string, source netip.AddrPort, destination netip.AddrPort) (*Info, error) {
inode, uid, err := resolveSocketByNetlink(network, source, destination) socket, err := resolveSocketByNetlink(network, source, destination)
if err != nil { if err != nil {
return nil, err return nil, err
} }
processPath, err := resolveProcessNameByProcSearch(inode, uid) processPath, err := resolveProcessNameByProcSearch(socket.INode, socket.UID)
if err != nil { if err != nil {
s.logger.DebugContext(ctx, "find process path: ", err) s.logger.DebugContext(ctx, "find process path: ", err)
} }
return &Info{ return &Info{
UserId: int32(uid), UserId: int32(socket.UID),
ProcessPath: processPath, ProcessPath: processPath,
}, nil }, nil
} }

View File

@@ -6,7 +6,6 @@ import (
"bytes" "bytes"
"encoding/binary" "encoding/binary"
"fmt" "fmt"
"net"
"net/netip" "net/netip"
"os" "os"
"path" "path"
@@ -15,9 +14,7 @@ import (
"unicode" "unicode"
"unsafe" "unsafe"
"github.com/sagernet/sing/common" "github.com/sagernet/netlink"
"github.com/sagernet/sing/common/buf"
E "github.com/sagernet/sing/common/exceptions"
N "github.com/sagernet/sing/common/network" N "github.com/sagernet/sing/common/network"
) )
@@ -37,7 +34,7 @@ const (
pathProc = "/proc" pathProc = "/proc"
) )
func resolveSocketByNetlink(network string, source netip.AddrPort, destination netip.AddrPort) (inode, uid uint32, err error) { func resolveSocketByNetlink(network string, source netip.AddrPort, destination netip.AddrPort) (*netlink.Socket, error) {
var family uint8 var family uint8
var protocol uint8 var protocol uint8
@@ -47,110 +44,28 @@ func resolveSocketByNetlink(network string, source netip.AddrPort, destination n
case N.NetworkUDP: case N.NetworkUDP:
protocol = syscall.IPPROTO_UDP protocol = syscall.IPPROTO_UDP
default: default:
return 0, 0, os.ErrInvalid return nil, os.ErrInvalid
} }
if source.Addr().Is4() { if source.Addr().Is4() {
family = syscall.AF_INET family = syscall.AF_INET
} else { } else {
family = syscall.AF_INET6 family = syscall.AF_INET6
} }
sockets, err := netlink.SocketGet(family, protocol, source, netip.AddrPortFrom(netip.IPv6Unspecified(), 0))
req := packSocketDiagRequest(family, protocol, source) if err == nil {
sockets, err = netlink.SocketGet(family, protocol, source, destination)
socket, err := syscall.Socket(syscall.AF_NETLINK, syscall.SOCK_DGRAM, syscall.NETLINK_INET_DIAG) }
if err != nil { if err != nil {
return 0, 0, E.Cause(err, "dial netlink") return nil, err
} }
defer syscall.Close(socket) if len(sockets) > 1 {
for _, socket := range sockets {
syscall.SetsockoptTimeval(socket, syscall.SOL_SOCKET, syscall.SO_SNDTIMEO, &syscall.Timeval{Usec: 100}) if socket.ID.DestinationPort == destination.Port() {
syscall.SetsockoptTimeval(socket, syscall.SOL_SOCKET, syscall.SO_RCVTIMEO, &syscall.Timeval{Usec: 100}) return socket, nil
}
err = syscall.Connect(socket, &syscall.SockaddrNetlink{ }
Family: syscall.AF_NETLINK,
Pad: 0,
Pid: 0,
Groups: 0,
})
if err != nil {
return
} }
return sockets[0], nil
_, err = syscall.Write(socket, req)
if err != nil {
return 0, 0, E.Cause(err, "write netlink request")
}
_buffer := buf.StackNew()
defer common.KeepAlive(_buffer)
buffer := common.Dup(_buffer)
defer buffer.Release()
n, err := syscall.Read(socket, buffer.FreeBytes())
if err != nil {
return 0, 0, E.Cause(err, "read netlink response")
}
buffer.Truncate(n)
messages, err := syscall.ParseNetlinkMessage(buffer.Bytes())
if err != nil {
return 0, 0, E.Cause(err, "parse netlink message")
} else if len(messages) == 0 {
return 0, 0, E.New("unexcepted netlink response")
}
message := messages[0]
if message.Header.Type&syscall.NLMSG_ERROR != 0 {
return 0, 0, E.New("netlink message: NLMSG_ERROR")
}
inode, uid = unpackSocketDiagResponse(&messages[0])
return
}
func packSocketDiagRequest(family, protocol byte, source netip.AddrPort) []byte {
s := make([]byte, 16)
copy(s, source.Addr().AsSlice())
buf := make([]byte, sizeOfSocketDiagRequest)
nativeEndian.PutUint32(buf[0:4], sizeOfSocketDiagRequest)
nativeEndian.PutUint16(buf[4:6], socketDiagByFamily)
nativeEndian.PutUint16(buf[6:8], syscall.NLM_F_REQUEST|syscall.NLM_F_DUMP)
nativeEndian.PutUint32(buf[8:12], 0)
nativeEndian.PutUint32(buf[12:16], 0)
buf[16] = family
buf[17] = protocol
buf[18] = 0
buf[19] = 0
nativeEndian.PutUint32(buf[20:24], 0xFFFFFFFF)
binary.BigEndian.PutUint16(buf[24:26], source.Port())
binary.BigEndian.PutUint16(buf[26:28], 0)
copy(buf[28:44], s)
copy(buf[44:60], net.IPv6zero)
nativeEndian.PutUint32(buf[60:64], 0)
nativeEndian.PutUint64(buf[64:72], 0xFFFFFFFFFFFFFFFF)
return buf
}
func unpackSocketDiagResponse(msg *syscall.NetlinkMessage) (inode, uid uint32) {
if len(msg.Data) < 72 {
return 0, 0
}
data := msg.Data
uid = nativeEndian.Uint32(data[64:68])
inode = nativeEndian.Uint32(data[68:72])
return
} }
func resolveProcessNameByProcSearch(inode, uid uint32) (string, error) { func resolveProcessNameByProcSearch(inode, uid uint32) (string, error) {

View File

@@ -1,64 +0,0 @@
package redir
import (
"net"
"net/netip"
"syscall"
"unsafe"
M "github.com/sagernet/sing/common/metadata"
)
const (
PF_OUT = 0x2
DIOCNATLOOK = 0xc0544417
)
func GetOriginalDestination(conn net.Conn) (destination netip.AddrPort, err error) {
fd, err := syscall.Open("/dev/pf", 0, syscall.O_RDONLY)
if err != nil {
return netip.AddrPort{}, err
}
defer syscall.Close(fd)
nl := struct {
saddr, daddr, rsaddr, rdaddr [16]byte
sxport, dxport, rsxport, rdxport [4]byte
af, proto, protoVariant, direction uint8
}{
af: syscall.AF_INET,
proto: syscall.IPPROTO_TCP,
direction: PF_OUT,
}
la := conn.LocalAddr().(*net.TCPAddr)
ra := conn.RemoteAddr().(*net.TCPAddr)
raIP, laIP := ra.IP, la.IP
raPort, laPort := ra.Port, la.Port
switch {
case raIP.To4() != nil:
copy(nl.saddr[:net.IPv4len], raIP.To4())
copy(nl.daddr[:net.IPv4len], laIP.To4())
nl.af = syscall.AF_INET
default:
copy(nl.saddr[:], raIP.To16())
copy(nl.daddr[:], laIP.To16())
nl.af = syscall.AF_INET6
}
nl.sxport[0], nl.sxport[1] = byte(raPort>>8), byte(raPort)
nl.dxport[0], nl.dxport[1] = byte(laPort>>8), byte(laPort)
if _, _, errno := syscall.Syscall(syscall.SYS_IOCTL, uintptr(fd), DIOCNATLOOK, uintptr(unsafe.Pointer(&nl))); errno != 0 {
return netip.AddrPort{}, errno
}
var ip net.IP
switch nl.af {
case syscall.AF_INET:
ip = make(net.IP, net.IPv4len)
copy(ip, nl.rdaddr[:net.IPv4len])
case syscall.AF_INET6:
ip = make(net.IP, net.IPv6len)
copy(ip, nl.rdaddr[:])
}
port := uint16(nl.rdxport[0])<<8 | uint16(nl.rdxport[1])
destination = netip.AddrPortFrom(M.AddrFromIP(ip), port)
return
}

View File

@@ -1,4 +1,4 @@
//go:build !linux && !darwin //go:build !linux
package redir package redir

View File

@@ -1,7 +1,6 @@
package settings package settings
import ( import (
"net/netip"
"strings" "strings"
"github.com/sagernet/sing-box/adapter" "github.com/sagernet/sing-box/adapter"
@@ -21,7 +20,7 @@ type systemProxy struct {
} }
func (p *systemProxy) update() error { func (p *systemProxy) update() error {
newInterfaceName := p.monitor.DefaultInterfaceName(netip.IPv4Unspecified()) newInterfaceName := p.monitor.DefaultInterfaceName()
if p.interfaceName == newInterfaceName { if p.interfaceName == newInterfaceName {
return nil return nil
} }

View File

@@ -22,7 +22,7 @@ func StreamDomainNameQuery(readCtx context.Context, reader io.Reader) (*adapter.
if err != nil { if err != nil {
return nil, err return nil, err
} }
if length == 0 { if length > 512 {
return nil, os.ErrInvalid return nil, os.ErrInvalid
} }
_buffer := buf.StackNewSize(int(length)) _buffer := buf.StackNewSize(int(length))

View File

@@ -18,7 +18,6 @@ const (
TypeHysteria = "hysteria" TypeHysteria = "hysteria"
TypeTor = "tor" TypeTor = "tor"
TypeSSH = "ssh" TypeSSH = "ssh"
TypeShadowTLS = "shadowtls"
) )
const ( const (

View File

@@ -1,6 +1,6 @@
package constant package constant
var ( var (
Version = "1.0.2" Version = "1.0"
Commit = "" Commit = ""
) )

View File

@@ -1,68 +1,4 @@
#### 1.0.1 #### 2022/08/24
* Fix match 4in6 address in ip_cidr
* Fix clash api log level format error
* Fix clash api unknown proxy type
#### 1.0
* Fix wireguard reconnect
* Fix naive inbound
* Fix json format error message
* Fix processing vmess termination signal
* Fix hysteria stream error
* Fix listener close when proxyproto failed
#### 1.0-rc1
* Fix write log timestamp
* Fix write zero
* Fix dial parallel in direct outbound
* Fix write trojan udp
* Fix DNS routing
* Add attribute support for geosite
* Update documentation for [Dial Fields](/configuration/shared/dial)
#### 1.0-beta3
* Add [chained inbound](/configuration/shared/listen#detour) support
* Add process_path rule item
* Add macOS redirect support
* Add ShadowTLS [Inbound](/configuration/inbound/shadowtls), [Outbound](/configuration/outbound/shadowtls)
and [Examples](/examples/shadowtls)
* Fix search android package in non-owner users
* Fix socksaddr type condition
* Fix smux session status
* Refactor inbound and outbound documentation
* Minor fixes
#### 1.0-beta2
* Add strict_route option for [Tun inbound](/configuration/inbound/tun#strict_route)
* Add packetaddr support for [VMess outbound](/configuration/outbound/vmess#packet_addr)
* Add better performing alternative gRPC implementation
* Add [docker image](https://github.com/SagerNet/sing-box/pkgs/container/sing-box)
* Fix sniff override destination
#### 1.0-beta1
* Initial release
##### 2022/08/26
* Fix ipv6 route on linux
* Fix read DNS message
##### 2022/08/25
* Let vmess use zero instead of auto if TLS enabled
* Add trojan fallback for ALPN
* Improve ip_cidr rule
* Fix format bind_address
* Fix http proxy with compressed response
* Fix route connections
##### 2022/08/24
* Fix naive padding * Fix naive padding
* Fix unix search path * Fix unix search path
@@ -71,7 +7,7 @@
* Fix early close on windows and catch any * Fix early close on windows and catch any
* Initial zh-CN document translation * Initial zh-CN document translation
##### 2022/08/23 #### 2022/08/23
* Add [V2Ray Transport](/configuration/shared/v2ray-transport) support for VMess and Trojan * Add [V2Ray Transport](/configuration/shared/v2ray-transport) support for VMess and Trojan
* Allow plain http request in Naive inbound (It can now be used with nginx) * Allow plain http request in Naive inbound (It can now be used with nginx)
@@ -80,17 +16,17 @@
* Parse X-Forward-For in HTTP requests * Parse X-Forward-For in HTTP requests
* Handle SIGHUP signal * Handle SIGHUP signal
##### 2022/08/22 #### 2022/08/22
* Add strategy setting for each [DNS server](/configuration/dns/server) * Add strategy setting for each [DNS server](/configuration/dns/server)
* Add bind address to outbound options * Add bind address to outbound options
##### 2022/08/21 #### 2022/08/21
* Add [Tor outbound](/configuration/outbound/tor) * Add [Tor outbound](/configuration/outbound/tor)
* Add [SSH outbound](/configuration/outbound/ssh) * Add [SSH outbound](/configuration/outbound/ssh)
##### 2022/08/20 #### 2022/08/20
* Attempt to unwrap ip-in-fqdn socksaddr * Attempt to unwrap ip-in-fqdn socksaddr
* Fix read packages in android 12 * Fix read packages in android 12
@@ -100,52 +36,52 @@
* Skip bind connection with private destination to interface * Skip bind connection with private destination to interface
* Add [Trojan connection fallback](/configuration/inbound/trojan#fallback) * Add [Trojan connection fallback](/configuration/inbound/trojan#fallback)
##### 2022/08/19 #### 2022/08/19
* Add Hysteria [Inbound](/configuration/inbound/hysteria) and [Outbund](/configuration/outbound/hysteria) * Add Hysteria [Inbound](/configuration/inbound/hysteria) and [Outbund](/configuration/outbound/hysteria)
* Add [ACME TLS certificate issuer](/configuration/shared/tls) * Add [ACME TLS certificate issuer](/configuration/shared/tls)
* Allow read config from stdin (-c stdin) * Allow read config from stdin (-c stdin)
* Update gVisor to 20220815.0 * Update gVisor to 20220815.0
##### 2022/08/18 #### 2022/08/18
* Fix find process with lwip stack * Fix find process with lwip stack
* Fix crash on shadowsocks server * Fix crash on shadowsocks server
* Fix crash on darwin tun * Fix crash on darwin tun
* Fix write log to file * Fix write log to file
##### 2022/08/17 #### 2022/08/17
* Improve async dns transports * Improve async dns transports
##### 2022/08/16 #### 2022/08/16
* Add ip_version (route/dns) rule item * Add ip_version (route/dns) rule item
* Add [WireGuard](/configuration/outbound/wireguard) outbound * Add [WireGuard](/configuration/outbound/wireguard) outbound
##### 2022/08/15 #### 2022/08/15
* Add uid, android user and package rules support in [Tun](/configuration/inbound/tun) routing. * Add uid, android user and package rules support in [Tun](/configuration/inbound/tun) routing.
##### 2022/08/13 #### 2022/08/13
* Fix dns concurrent write * Fix dns concurrent write
##### 2022/08/12 #### 2022/08/12
* Performance improvements * Performance improvements
* Add UoT option for [SOCKS](/configuration/outbound/socks) outbound * Add UoT option for [SOCKS](/configuration/outbound/socks) outbound
##### 2022/08/11 #### 2022/08/11
* Add UoT option for [Shadowsocks](/configuration/outbound/shadowsocks) outbound, UoT support for all inbounds * Add UoT option for [Shadowsocks](/configuration/outbound/shadowsocks) outbound, UoT support for all inbounds
##### 2022/08/10 #### 2022/08/10
* Add full-featured [Naive](/configuration/inbound/naive) inbound * Add full-featured [Naive](/configuration/inbound/naive) inbound
* Fix default dns server option [#9] by iKirby * Fix default dns server option [#9] by iKirby
##### 2022/08/09 #### 2022/08/09
No changelog before. No changelog before.

View File

@@ -1,5 +1,3 @@
# DNS
### Structure ### Structure
```json ```json

View File

@@ -38,8 +38,7 @@
"private" "private"
], ],
"source_ip_cidr": [ "source_ip_cidr": [
"10.0.0.0/24", "10.0.0.0/24"
"192.168.0.1"
], ],
"source_port": [ "source_port": [
12345 12345
@@ -61,9 +60,6 @@
"process_name": [ "process_name": [
"curl" "curl"
], ],
"process_path": [
"/usr/bin/curl"
],
"package_name": [ "package_name": [
"com.termux" "com.termux"
], ],
@@ -180,14 +176,6 @@ Match port range.
Match process name. Match process name.
#### process_path
!!! error ""
Only supported on Linux, Windows, and macOS.
Match process path.
#### package_name #### package_name
Match android package name. Match android package name.

View File

@@ -60,9 +60,6 @@
"process_name": [ "process_name": [
"curl" "curl"
], ],
"process_path": [
"/usr/bin/curl"
],
"package_name": [ "package_name": [
"com.termux" "com.termux"
], ],
@@ -179,14 +176,6 @@
匹配进程名称。 匹配进程名称。
#### process_path
!!! error ""
仅支持 Linux、Windows 和 macOS.
匹配进程路径。
#### package_name #### package_name
匹配 Android 应用包名。 匹配 Android 应用包名。

View File

@@ -47,7 +47,7 @@ DNS 服务器的地址。
!!! warning "" !!! warning ""
默认安装不包含 QUIC 和 HTTP3 传输层,请参阅 [安装](/zh/#_2)。 默认安装不包含 QUIC 和 HTTP3 传输层,请参阅 [安装](/zh/#installation)。
!!! info "" !!! info ""

View File

@@ -1,5 +1,3 @@
# Experimental
### Structure ### Structure
```json ```json

View File

@@ -18,7 +18,7 @@
!!! error "" !!! error ""
默认安装不包含 Clash API参阅 [安装](/zh/#_2)。 默认安装不包含 Clash API参阅 [安装](/zh/#installation)。
!!! note "" !!! note ""

View File

@@ -4,22 +4,29 @@
```json ```json
{ {
"type": "direct", "inbounds": [
"tag": "direct-in", {
"type": "direct",
"tag": "direct-in",
... // Listen Fields "listen": "::",
"listen_port": 5353,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"udp_timeout": 300,
"proxy_protocol": false,
"network": "udp", "network": "udp",
"override_address": "1.0.0.1", "override_address": "1.0.0.1",
"override_port": 53 "override_port": 53
}
]
} }
``` ```
### Listen Fields ### Direct Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### network #### network
@@ -34,3 +41,49 @@ Override the connection destination address.
#### override_port #### override_port
Override the connection destination port. Override the connection destination port.
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### tcp_fast_open
Enable tcp fast open for listener.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.
#### udp_timeout
UDP NAT expiration time in seconds, default is 300 (5 minutes).
#### proxy_protocol
Parse [Proxy Protocol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) in the connection header.

View File

@@ -4,22 +4,29 @@
```json ```json
{ {
"type": "direct", "inbounds": [
"tag": "direct-in", {
"type": "direct",
"tag": "direct-in",
... // 监听字段 "listen": "::",
"listen_port": 5353,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"udp_timeout": 300,
"network": "udp", "network": "udp",
"override_address": "1.0.0.1", "proxy_protocol": false,
"override_port": 53 "override_address": "1.0.0.1",
"override_port": 53
}
]
} }
``` ```
### 监听字段 ### Direct 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### network #### network
@@ -35,3 +42,48 @@
覆盖连接目标端口。 覆盖连接目标端口。
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### tcp_fast_open
为监听器启用 TCP 快速打开。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### udp_timeout
UDP NAT 过期时间,以秒为单位,默认为 3005 分钟)。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -2,27 +2,33 @@
```json ```json
{ {
"type": "http", "inbounds": [
"tag": "http-in",
... // Listen Fields
"users": [
{ {
"username": "admin", "type": "http",
"password": "admin" "tag": "http-in",
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"username": "admin",
"password": "admin"
}
],
"tls": {},
"set_system_proxy": false
} }
], ]
"tls": {},
"set_system_proxy": false
} }
``` ```
### Listen Fields ### HTTP Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### tls #### tls
@@ -41,3 +47,45 @@ No authentication required if empty.
Only supported on Linux, Android, Windows, and macOS. Only supported on Linux, Android, Windows, and macOS.
Automatically set system proxy configuration when start and clean up when stop. Automatically set system proxy configuration when start and clean up when stop.
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### tcp_fast_open
Enable tcp fast open for listener.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.
#### proxy_protocol
Parse [Proxy Protocol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) in the connection header.

View File

@@ -2,27 +2,33 @@
```json ```json
{ {
"type": "http", "inbounds": [
"tag": "http-in",
... // 监听字段
"users": [
{ {
"username": "admin", "type": "http",
"password": "admin" "tag": "http-in",
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"username": "admin",
"password": "admin"
}
],
"tls": {},
"set_system_proxy": false
} }
], ]
"tls": {},
"set_system_proxy": false
} }
``` ```
### 监听字段 ### HTTP 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### tls #### tls
@@ -32,7 +38,7 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
HTTP 用户 HTTP 用户
如果为空则不需要验证。 默认不需要验证。
#### set_system_proxy #### set_system_proxy
@@ -41,3 +47,45 @@ HTTP 用户
仅支持 Linux、Android、Windows 和 macOS。 仅支持 Linux、Android、Windows 和 macOS。
启动时自动设置系统代理,停止时自动清理。 启动时自动设置系统代理,停止时自动清理。
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### tcp_fast_open
为监听器启用 TCP 快速打开。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -2,23 +2,31 @@
```json ```json
{ {
"type": "hysteria", "inbounds": [
"tag": "hysteria-in", {
"type": "hysteria",
"tag": "hysteria-in",
... // Listen Fields "listen": "::",
"listen_port": 443,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"up": "100 Mbps", "up": "100 Mbps",
"up_mbps": 100, "up_mbps": 100,
"down": "100 Mbps", "down": "100 Mbps",
"down_mbps": 100, "down_mbps": 100,
"obfs": "fuck me till the daylight", "obfs": "fuck me till the daylight",
"auth": "", "auth": "",
"auth_str": "password", "auth_str": "password",
"recv_window_conn": 0, "recv_window_conn": 0,
"recv_window_client": 0, "recv_window_client": 0,
"max_conn_client": 0, "max_conn_client": 0,
"disable_mtu_discovery": false, "disable_mtu_discovery": false,
"tls": {} "tls": {}
}
]
} }
``` ```
@@ -26,11 +34,7 @@
QUIC, which is required by hysteria is not included by default, see [Installation](/#installation). QUIC, which is required by hysteria is not included by default, see [Installation](/#installation).
### Listen Fields ### Hysteria Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### up, down #### up, down
@@ -98,3 +102,37 @@ Force enabled on for systems other than Linux and Windows (according to upstream
==Required== ==Required==
TLS configuration, see [TLS](/configuration/shared/tls/#inbound). TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.

View File

@@ -2,35 +2,39 @@
```json ```json
{ {
"type": "hysteria", "inbounds": [
"tag": "hysteria-in", {
"type": "hysteria",
"tag": "hysteria-in",
... // 监听字段 "listen": "::",
"listen_port": 443,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"up": "100 Mbps", "up": "100 Mbps",
"up_mbps": 100, "up_mbps": 100,
"down": "100 Mbps", "down": "100 Mbps",
"down_mbps": 100, "down_mbps": 100,
"obfs": "fuck me till the daylight", "obfs": "fuck me till the daylight",
"auth": "", "auth": "",
"auth_str": "password", "auth_str": "password",
"recv_window_conn": 0, "recv_window_conn": 0,
"recv_window_client": 0, "recv_window_client": 0,
"max_conn_client": 0, "max_conn_client": 0,
"disable_mtu_discovery": false, "disable_mtu_discovery": false,
"tls": {} "tls": {}
}
]
} }
``` ```
!!! warning "" !!! warning ""
默认安装不包含被 Hysteria 依赖的 QUIC参阅 [安装](/zh/#_2)。 默认安装不包含被 Hysteria 依赖的 QUIC参阅 [安装](/zh/#installation)。
### 监听字段 ### Hysteria 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### up, down #### up, down
@@ -98,3 +102,37 @@ base64 编码的认证密码。
==必填== ==必填==
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。 TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。

View File

@@ -1,5 +1,3 @@
# Inbound
### Structure ### Structure
```json ```json
@@ -15,20 +13,20 @@
### Fields ### Fields
| Type | Format | Injectable | | Type | Format |
|---------------|------------------------------|------------| |---------------|------------------------------|
| `direct` | [Direct](./direct) | X | | `direct` | [Direct](./direct) |
| `mixed` | [Mixed](./mixed) | TCP | | `mixed` | [Mixed](./mixed) |
| `socks` | [SOCKS](./socks) | TCP | | `socks` | [SOCKS](./socks) |
| `http` | [HTTP](./http) | TCP | | `http` | [HTTP](./http) |
| `shadowsocks` | [Shadowsocks](./shadowsocks) | TCP | | `shadowsocks` | [Shadowsocks](./shadowsocks) |
| `vmess` | [VMess](./vmess) | TCP | | `vmess` | [VMess](./vmess) |
| `trojan` | [Trojan](./trojan) | TCP | | `trojan` | [Trojan](./trojan) |
| `naive` | [Naive](./naive) | X | | `naive` | [Naive](./naive) |
| `hysteria` | [Hysteria](./hysteria) | X | | `hysteria` | [Hysteria](./hysteria) |
| `tun` | [Tun](./tun) | X | | `tun` | [Tun](./tun) |
| `redirect` | [Redirect](./redirect) | X | | `redirect` | [Redirect](./redirect) |
| `tproxy` | [TProxy](./tproxy) | X | | `tproxy` | [TProxy](./tproxy) |
#### tag #### tag

View File

@@ -15,20 +15,20 @@
### 字段 ### 字段
| 类型 | 格式 | 注入支持 | | 类型 | 格式 |
|---------------|------------------------------|------| |---------------|------------------------------|
| `direct` | [Direct](./direct) | X | | `direct` | [Direct](./direct) |
| `mixed` | [Mixed](./mixed) | TCP | | `mixed` | [Mixed](./mixed) |
| `socks` | [SOCKS](./socks) | TCP | | `socks` | [SOCKS](./socks) |
| `http` | [HTTP](./http) | TCP | | `http` | [HTTP](./http) |
| `shadowsocks` | [Shadowsocks](./shadowsocks) | TCP | | `shadowsocks` | [Shadowsocks](./shadowsocks) |
| `vmess` | [VMess](./vmess) | TCP | | `vmess` | [VMess](./vmess) |
| `trojan` | [Trojan](./trojan) | TCP | | `trojan` | [Trojan](./trojan) |
| `naive` | [Naive](./naive) | X | | `naive` | [Naive](./naive) |
| `hysteria` | [Hysteria](./hysteria) | X | | `hysteria` | [Hysteria](./hysteria) |
| `tun` | [Tun](./tun) | X | | `tun` | [Tun](./tun) |
| `redirect` | [Redirect](./redirect) | X | | `redirect` | [Redirect](./redirect) |
| `tproxy` | [TProxy](./tproxy) | X | | `tproxy` | [TProxy](./tproxy) |
#### tag #### tag

View File

@@ -4,26 +4,32 @@
```json ```json
{ {
"type": "mixed", "inbounds": [
"tag": "mixed-in",
... // Listen Fields
"users": [
{ {
"username": "admin", "type": "mixed",
"password": "admin" "tag": "mixed-in",
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"username": "admin",
"password": "admin"
}
],
"set_system_proxy": false
} }
], ]
"set_system_proxy": false
} }
``` ```
### Listen Fields ### Mixed Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### users #### users
@@ -38,3 +44,49 @@ No authentication required if empty.
Only supported on Linux, Android, Windows, and macOS. Only supported on Linux, Android, Windows, and macOS.
Automatically set system proxy configuration when start and clean up when stop. Automatically set system proxy configuration when start and clean up when stop.
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### tcp_fast_open
Enable tcp fast open for listener.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.
#### set_system_proxy
!!! error ""
Only supported on Linux, Android, Windows, and macOS.
Automatically set system proxy configuration when start and clean up when stop.

View File

@@ -4,32 +4,38 @@
```json ```json
{ {
"type": "mixed", "inbounds": [
"tag": "mixed-in",
... // 监听字段
"users": [
{ {
"username": "admin", "type": "mixed",
"password": "admin" "tag": "mixed-in",
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"username": "admin",
"password": "admin"
}
],
"set_system_proxy": false
} }
], ]
"set_system_proxy": false
} }
``` ```
### 监听字段 ### Mixed 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### users #### users
SOCKS 和 HTTP 用户 SOCKS 和 HTTP 用户
如果为空则不需要验证。 默认不需要验证。
#### set_system_proxy #### set_system_proxy
@@ -38,3 +44,45 @@ SOCKS 和 HTTP 用户
仅支持 Linux、Android、Windows 和 macOS。 仅支持 Linux、Android、Windows 和 macOS。
启动时自动设置系统代理,停止时自动清理。 启动时自动设置系统代理,停止时自动清理。
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### tcp_fast_open
为监听器启用 TCP 快速打开。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -2,19 +2,29 @@
```json ```json
{ {
"type": "naive", "inbounds": [
"tag": "naive-in",
"network": "udp",
... // Listen Fields
"users": [
{ {
"username": "sekai", "type": "naive",
"password": "password" "tag": "naive-in",
"listen": "::",
"listen_port": 443,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"network": "udp",
"users": [
{
"username": "sekai",
"password": "password"
}
],
"tls": {}
} }
], ]
"tls": {}
} }
``` ```
@@ -22,11 +32,7 @@
HTTP3 transport is not included by default, see [Installation](/#installation). HTTP3 transport is not included by default, see [Installation](/#installation).
### Listen Fields ### Naive Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### network #### network
@@ -43,3 +49,45 @@ Naive users.
#### tls #### tls
TLS configuration, see [TLS](/configuration/shared/tls/#inbound). TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### tcp_fast_open
Enable tcp fast open for listener.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.
#### proxy_protocol
Parse [Proxy Protocol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) in the connection header.

View File

@@ -2,31 +2,37 @@
```json ```json
{ {
"type": "naive", "inbounds": [
"tag": "naive-in",
"network": "udp",
... // 监听字段
"users": [
{ {
"username": "sekai", "type": "naive",
"password": "password" "tag": "naive-in",
"listen": "::",
"listen_port": 443,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"network": "udp",
"users": [
{
"username": "sekai",
"password": "password"
}
],
"tls": {}
} }
], ]
"tls": {}
} }
``` ```
!!! warning "" !!! warning ""
默认安装不包含 HTTP3 传输层, 参阅 [安装](/zh/#_2)。 默认安装不包含 HTTP3 传输层, 参阅 [安装](/zh/#installation)。
### 监听字段 ### Naive 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### network #### network
@@ -43,3 +49,45 @@ Naive 用户。
#### tls #### tls
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。 TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### tcp_fast_open
为监听器启用 TCP 快速打开。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -1,18 +1,52 @@
!!! error ""
Only supported on Linux and macOS.
### Structure ### Structure
```json ```json
{ {
"type": "redirect", "inbounds": [
"tag": "redirect-in", {
"type": "redirect",
"tag": "redirect-in",
... // Listen Fields "listen": "::",
"listen_port": 5353,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6"
}
]
} }
``` ```
### Listen Fields ### Listen Fields
See [Listen Fields](/configuration/shared/listen) for details. #### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.

View File

@@ -1,17 +1,52 @@
!!! error ""
仅支持 Linux 和 macOS。
### 结构 ### 结构
```json ```json
{ {
"type": "redirect", "inbounds": [
"tag": "redirect-in", {
"type": "redirect",
"tag": "redirect-in",
... // 监听字段 "listen": "::",
"listen_port": 5353,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6"
}
]
} }
``` ```
### 监听字段 ### 监听字段
参阅 [监听字段](/zh/configuration/shared/listen/)。 #### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。

View File

@@ -2,13 +2,25 @@
```json ```json
{ {
"type": "shadowsocks", "inbounds": [
"tag": "ss-in", {
"type": "shadowsocks",
"tag": "ss-in",
... // Listen Fields "listen": "::",
"listen_port": 5353,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"udp_timeout": 300,
"network": "udp",
"proxy_protocol": false,
"method": "2022-blake3-aes-128-gcm", "method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg==" "password": "8JCsPssfgS8tiRwiMlhARg=="
}
]
} }
``` ```
@@ -16,12 +28,17 @@
```json ```json
{ {
"method": "2022-blake3-aes-128-gcm", "inbounds": [
"password": "8JCsPssfgS8tiRwiMlhARg==",
"users": [
{ {
"name": "sekai", "type": "shadowsocks",
"password": "PCD2Z4o12bKUoFa3cC97Hw==" "method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg==",
"users": [
{
"name": "sekai",
"password": "PCD2Z4o12bKUoFa3cC97Hw=="
}
]
} }
] ]
} }
@@ -31,25 +48,25 @@
```json ```json
{ {
"type": "shadowsocks", "inbounds": [
"method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg==",
"destinations": [
{ {
"name": "test", "type": "shadowsocks",
"server": "example.com", "method": "2022-blake3-aes-128-gcm",
"server_port": 8080, "password": "8JCsPssfgS8tiRwiMlhARg==",
"password": "PCD2Z4o12bKUoFa3cC97Hw==" "destinations": [
{
"name": "test",
"server": "example.com",
"server_port": 8080,
"password": "PCD2Z4o12bKUoFa3cC97Hw=="
}
]
} }
] ]
} }
``` ```
### Listen Fields ### Shadowsocks Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### network #### network

View File

@@ -2,13 +2,25 @@
```json ```json
{ {
"type": "shadowsocks", "inbounds": [
"tag": "ss-in", {
"type": "shadowsocks",
"tag": "ss-in",
... // 监听字段 "listen": "::",
"listen_port": 5353,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"udp_timeout": 300,
"network": "udp",
"proxy_protocol": false,
"method": "2022-blake3-aes-128-gcm", "method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg==" "password": "8JCsPssfgS8tiRwiMlhARg=="
}
]
} }
``` ```
@@ -16,12 +28,17 @@
```json ```json
{ {
"method": "2022-blake3-aes-128-gcm", "inbounds": [
"password": "8JCsPssfgS8tiRwiMlhARg==",
"users": [
{ {
"name": "sekai", "type": "shadowsocks",
"password": "PCD2Z4o12bKUoFa3cC97Hw==" "method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg==",
"users": [
{
"name": "sekai",
"password": "PCD2Z4o12bKUoFa3cC97Hw=="
}
]
} }
] ]
} }
@@ -31,25 +48,25 @@
```json ```json
{ {
"type": "shadowsocks", "inbounds": [
"method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg==",
"destinations": [
{ {
"name": "test", "type": "shadowsocks",
"server": "example.com", "method": "2022-blake3-aes-128-gcm",
"server_port": 8080, "password": "8JCsPssfgS8tiRwiMlhARg==",
"password": "PCD2Z4o12bKUoFa3cC97Hw==" "destinations": [
{
"name": "test",
"server": "example.com",
"server_port": 8080,
"password": "PCD2Z4o12bKUoFa3cC97Hw=="
}
]
} }
] ]
} }
``` ```
### Listen Fields ### Shadowsocks 字段
See [Listen Fields](/configuration/shared/listen) for details.
### 字段
#### network #### network
@@ -82,3 +99,49 @@ See [Listen Fields](/configuration/shared/listen) for details.
| none | / | | none | / |
| 2022 methods | `openssl rand -base64 <密钥长度>` | | 2022 methods | `openssl rand -base64 <密钥长度>` |
| other methods | 任意字符串 | | other methods | 任意字符串 |
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### tcp_fast_open
为监听器启用 TCP 快速打开。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### udp_timeout
UDP NAT 过期时间,以秒为单位,默认为 3005 分钟)。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -1,31 +0,0 @@
### Structure
```json
{
"type": "shadowtls",
"tag": "st-in",
... // Listen Fields
"handshake": {
"server": "google.com",
"server_port": 443,
... // Dial Fields
}
}
```
### Listen Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### handshake
==Required==
Handshake server address and [dial options](/configuration/shared/dial).

View File

@@ -1,29 +0,0 @@
### 结构
```json
{
"type": "shadowtls",
"tag": "st-in",
... // 监听字段
"handshake": {
"server": "google.com",
"server_port": 443,
... // 拨号字段
}
}
```
### 监听字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### handshake
==必填==
握手服务器地址和 [拨号参数](/zh/configuration/shared/dial/)。

View File

@@ -4,28 +4,76 @@
```json ```json
{ {
"type": "socks", "inbounds": [
"tag": "socks-in",
... // Listen Fields
"users": [
{ {
"username": "admin", "type": "socks",
"password": "admin" "tag": "socks-in",
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"username": "admin",
"password": "admin"
}
]
} }
] ]
} }
``` ```
### Listen Fields ### SOCKS Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### users #### users
SOCKS users. SOCKS users.
No authentication required if empty. No authentication required if empty.
### 监听字段
#### listen
==必填==
监听地址
#### listen_port
==必填==
监听端口
#### tcp_fast_open
为监听器启用 TCP 快速打开
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -4,28 +4,76 @@
```json ```json
{ {
"type": "socks", "inbounds": [
"tag": "socks-in",
... // 监听字段
"users": [
{ {
"username": "admin", "type": "socks",
"password": "admin" "tag": "socks-in",
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"username": "admin",
"password": "admin"
}
]
} }
] ]
} }
``` ```
### 监听字段 ### SOCKS 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### users #### users
SOCKS 用户 SOCKS 用户
如果为空则不需要验证。 默认不需要验证。
### Listen Fields
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### tcp_fast_open
为监听器启用 TCP 快速打开。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -1,28 +1,67 @@
!!! error ""
Only supported on Linux.
### Structure ### Structure
```json ```json
{ {
"type": "tproxy", "inbounds": [
"tag": "tproxy-in", {
"type": "tproxy",
"tag": "tproxy-in",
... // Listen Fields "listen": "::",
"listen_port": 5353,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"udp_timeout": 300,
"network": "udp" "network": "udp"
}
]
} }
``` ```
### Listen Fields ### TProxy Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### network #### network
Listen network, one of `tcp` `udp`. Listen network, one of `tcp` `udp`.
Both if empty. Both if empty.
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.
#### udp_timeout
UDP NAT expiration time in seconds, default is 300 (5 minutes).

View File

@@ -1,28 +1,67 @@
!!! error ""
仅支持 Linux。
### 结构 ### 结构
```json ```json
{ {
"type": "tproxy", "inbounds": [
"tag": "tproxy-in", {
"type": "tproxy",
"tag": "tproxy-in",
... // 监听字段 "listen": "::",
"listen_port": 5353,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"udp_timeout": 300,
"network": "udp" "network": "udp"
}
]
} }
``` ```
### 监听字段 ### TProxy 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### network #### network
监听的网络协议,`tcp` `udp` 之一。 监听的网络协议,`tcp` `udp` 之一。
默认所有。 默认所有。
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### udp_timeout
UDP NAT 过期时间,以秒为单位,默认为 3005 分钟)。

View File

@@ -2,37 +2,37 @@
```json ```json
{ {
"type": "trojan", "inbounds": [
"tag": "trojan-in",
... // Listen Fields
"users": [
{ {
"name": "sekai", "type": "trojan",
"password": "8JCsPssfgS8tiRwiMlhARg==" "tag": "trojan-in",
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"name": "sekai",
"password": "8JCsPssfgS8tiRwiMlhARg=="
}
],
"tls": {},
"fallback": {
"server": "127.0.0.0.1",
"server_port": 8080
},
"transport": {}
} }
], ]
"tls": {},
"fallback": {
"server": "127.0.0.1",
"server_port": 8080
},
"fallback_for_alpn": {
"http/1.1": {
"server": "127.0.0.1",
"server_port": 8081
}
},
"transport": {}
} }
``` ```
### Listen Fields ### Trojan Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### users #### users
@@ -50,14 +50,50 @@ TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
There is no evidence that GFW detects and blocks Trojan servers based on HTTP responses, and opening the standard http/s port on the server is a much bigger signature. There is no evidence that GFW detects and blocks Trojan servers based on HTTP responses, and opening the standard http/s port on the server is a much bigger signature.
Fallback server configuration. Disabled if `fallback` and `fallback_for_alpn` are empty. Fallback server configuration. Disabled if empty.
#### fallback_for_alpn
Fallback server configuration for specified ALPN.
If not empty, TLS fallback requests with ALPN not in this table will be rejected.
#### transport #### transport
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport). V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport).
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### tcp_fast_open
Enable tcp fast open for listener.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.
#### proxy_protocol
Parse [Proxy Protocol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) in the connection header.

View File

@@ -2,37 +2,37 @@
```json ```json
{ {
"type": "trojan", "inbounds": [
"tag": "trojan-in",
... // 监听字段
"users": [
{ {
"name": "sekai", "type": "trojan",
"password": "8JCsPssfgS8tiRwiMlhARg==" "tag": "trojan-in",
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"name": "sekai",
"password": "8JCsPssfgS8tiRwiMlhARg=="
}
],
"tls": {},
"fallback": {
"server": "127.0.0.0.1",
"server_port": 8080
},
"transport": {}
} }
], ]
"tls": {},
"fallback": {
"server": "127.0.0.1",
"server_port": 8080
},
"fallback_for_alpn": {
"http/1.1": {
"server": "127.0.0.1",
"server_port": 8081
}
},
"transport": {}
} }
``` ```
### 监听字段 ### Trojan 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### users #### users
@@ -50,16 +50,52 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
!!! error "" !!! error ""
没有证据表明 GFW 基于 HTTP 响应检测并阻止 Trojan 服务器,并且在服务器上打开标准 http/s 端口是一个更大的特征。 没有证据表明 GFW 基于 HTTP 响应检测并阻止木马服务器,并且在服务器上打开标准 http/s 端口是一个更大的特征。
回退服务器配置。如果 `fallback``fallback_for_alpn` 为空,则禁用回退 备用服务器配置。默认禁用
#### fallback_for_alpn
为 ALPN 指定回退服务器配置。
如果不为空ALPN 不在此列表中的 TLS 回退请求将被拒绝。
#### transport #### transport
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。 V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### tcp_fast_open
为监听器启用 TCP 快速打开。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -6,41 +6,47 @@
```json ```json
{ {
"type": "tun", "inbounds": [
"tag": "tun-in", {
"type": "tun",
"interface_name": "tun0", "tag": "tun-in",
"inet4_address": "172.19.0.1/30", "interface_name": "tun0",
"inet6_address": "fdfe:dcba:9876::1/128", "inet4_address": "172.19.0.1/30",
"mtu": 1500, "inet6_address": "fdfe:dcba:9876::1/128",
"auto_route": true, "mtu": 1500,
"strict_route": true, "auto_route": true,
"endpoint_independent_nat": false, "endpoint_independent_nat": false,
"stack": "gvisor", "udp_timeout": 300,
"include_uid": [ "stack": "gvisor",
0 "include_uid": [
], 0
"include_uid_range": [ ],
"1000-99999" "include_uid_range": [
], [
"exclude_uid": [ "1000-99999"
1000 ]
], ],
"exclude_uid_range": [ "exclude_uid": [
"1000-99999" 1000
], ],
"include_android_user": [ "exclude_uid_range": [
0, "1000-99999"
10 ],
], "include_android_user": [
"include_package": [ 0,
"com.android.chrome" 10
], ],
"exclude_package": [ "include_package": [
"com.android.captiveportallogin" "com.android.chrome"
], ],
"exclude_package": [
... // Listen Fields "com.android.captiveportallogin"
],
"sniff": true,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv4"
}
]
} }
``` ```
@@ -52,7 +58,7 @@
If tun is running in non-privileged mode, addresses and MTU will not be configured automatically, please make sure the settings are accurate. If tun is running in non-privileged mode, addresses and MTU will not be configured automatically, please make sure the settings are accurate.
### Fields ### Tun Fields
#### interface_name #### interface_name
@@ -80,16 +86,6 @@ Set the default route to the Tun.
To avoid traffic loopback, set `route.auto_detect_interface` or `route.default_interface` or `outbound.bind_interface` To avoid traffic loopback, set `route.auto_detect_interface` or `route.default_interface` or `outbound.bind_interface`
#### strict_route
Enforce strict routing rules in Linux when `auto_route` is enabled:
* Let unsupported network unreachable
* Route all connections to tun
It prevents address leaks and makes DNS hijacking work on Android and Linux with systemd-resolved, but your device will
not be accessible by others.
#### endpoint_independent_nat #### endpoint_independent_nat
Enable endpoint-independent NAT. Enable endpoint-independent NAT.
@@ -156,4 +152,22 @@ Exclude android packages in route.
### Listen Fields ### Listen Fields
See [Listen Fields](/configuration/shared/listen) for details. #### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.

View File

@@ -6,41 +6,47 @@
```json ```json
{ {
"type": "tun", "inbounds": [
"tag": "tun-in", {
"type": "tun",
"interface_name": "tun0", "tag": "tun-in",
"inet4_address": "172.19.0.1/30", "interface_name": "tun0",
"inet6_address": "fdfe:dcba:9876::1/128", "inet4_address": "172.19.0.1/30",
"mtu": 1500, "inet6_address": "fdfe:dcba:9876::1/128",
"auto_route": true, "mtu": 1500,
"strict_route": true, "auto_route": true,
"endpoint_independent_nat": false, "endpoint_independent_nat": false,
"stack": "gvisor", "udp_timeout": 300,
"include_uid": [ "stack": "gvisor",
0 "include_uid": [
], 0
"include_uid_range": [ ],
"1000-99999" "include_uid_range": [
], [
"exclude_uid": [ "1000-99999"
1000 ]
], ],
"exclude_uid_range": [ "exclude_uid": [
"1000-99999" 1000
], ],
"include_android_user": [ "exclude_uid_range": [
0, "1000-99999"
10 ],
], "include_android_user": [
"include_package": [ 0,
"com.android.chrome" 10
], ],
"exclude_package": [ "include_package": [
"com.android.captiveportallogin" "com.android.chrome"
], ],
"exclude_package": [
... // 监听字段 "com.android.captiveportallogin"
],
"sniff": true,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv4"
}
]
} }
``` ```
@@ -80,15 +86,6 @@ tun 接口的 IPv6 前缀。
为避免流量环回,请设置 `route.auto_detect_interface``route.default_interface``outbound.bind_interface` 为避免流量环回,请设置 `route.auto_detect_interface``route.default_interface``outbound.bind_interface`
#### strict_route
在 Linux 中启用 `auto_route` 时执行严格的路由规则。
* 让不支持的网络无法到达
* 将所有连接路由到 tun
它可以防止地址泄漏,并使 DNS 劫持在 Android 和使用 systemd-resolved 的 Linux 上工作,但你的设备将无法其他设备被访问。
#### endpoint_independent_nat #### endpoint_independent_nat
启用独立于端点的 NAT。 启用独立于端点的 NAT。
@@ -110,7 +107,7 @@ TCP/IP 栈。
!!! warning "" !!! warning ""
默认安装不包含 LWIP 栈,请参阅 [安装](/zh/#_2)。 默认安装不包含 LWIP 栈,请参阅 [安装](/zh/#installation)。
#### include_uid #### include_uid
@@ -155,4 +152,22 @@ TCP/IP 栈。
### 监听字段 ### 监听字段
参阅 [监听字段](/zh/configuration/shared/listen/)。 #### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。

View File

@@ -2,28 +2,34 @@
```json ```json
{ {
"type": "vmess", "inbounds": [
"tag": "vmess-in",
... // Listen Fields
"users": [
{ {
"name": "sekai", "type": "vmess",
"uuid": "bf000d23-0752-40b4-affe-68f7707a9661", "tag": "vmess-in",
"alterId": 0
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"name": "sekai",
"uuid": "bf000d23-0752-40b4-affe-68f7707a9661",
"alterId": 0
}
],
"tls": {},
"transport": {}
} }
], ]
"tls": {},
"transport": {}
} }
``` ```
### Listen Fields ### VMess Fields
See [Listen Fields](/configuration/shared/listen) for details.
### Fields
#### users #### users
@@ -47,3 +53,45 @@ TLS configuration, see [TLS](/configuration/shared/tls/#inbound).
#### transport #### transport
V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport). V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray-transport).
### Listen Fields
#### listen
==Required==
Listen address.
#### listen_port
==Required==
Listen port.
#### tcp_fast_open
Enable tcp fast open for listener.
#### sniff
Enable sniffing.
See [Protocol Sniff](/configuration/route/sniff/) for details.
#### sniff_override_destination
Override the connection destination address with the sniffed domain.
If the domain name is invalid (like tor), this will not work.
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before routing.
If `sniff_override_destination` is in effect, its value will be taken as a fallback.
#### proxy_protocol
Parse [Proxy Protocol](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt) in the connection header.

View File

@@ -2,28 +2,34 @@
```json ```json
{ {
"type": "vmess", "inbounds": [
"tag": "vmess-in",
... // 监听字段
"users": [
{ {
"name": "sekai", "type": "vmess",
"uuid": "bf000d23-0752-40b4-affe-68f7707a9661", "tag": "vmess-in",
"alterId": 0
"listen": "::",
"listen_port": 2080,
"tcp_fast_open": false,
"sniff": false,
"sniff_override_destination": false,
"domain_strategy": "prefer_ipv6",
"proxy_protocol": false,
"users": [
{
"name": "sekai",
"uuid": "bf000d23-0752-40b4-affe-68f7707a9661",
"alterId": 0
}
],
"tls": {},
"transport": {}
} }
], ]
"tls": {},
"transport": {}
} }
``` ```
### 监听字段 ### VMess 字段
参阅 [监听字段](/zh/configuration/shared/listen/)。
### 字段
#### users #### users
@@ -47,3 +53,45 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#inbound)。
#### transport #### transport
V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。 V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-transport)。
### 监听字段
#### listen
==必填==
监听地址。
#### listen_port
==必填==
监听端口。
#### tcp_fast_open
为监听器启用 TCP 快速打开。
#### sniff
启用协议探测。
参阅 [协议探测](/zh/configuration/route/sniff/)。
#### sniff_override_destination
用探测出的域名覆盖连接目标地址。
如果域名无效(如 Tor将不生效。
#### domain_strategy
可选值: `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,请求的域名将在路由之前解析为 IP。
如果 `sniff_override_destination` 生效,它的值将作为后备。
#### proxy_protocol
解析连接头中的 [代理协议](https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt)。

View File

@@ -8,8 +8,8 @@ sing-box uses JSON for configuration files.
{ {
"log": {}, "log": {},
"dns": {}, "dns": {},
"inbounds": [], "inbounds": {},
"outbounds": [], "outbounds": {},
"route": {}, "route": {},
"experimental": {} "experimental": {}
} }

View File

@@ -8,8 +8,8 @@ sing-box 使用 JSON 作为配置文件格式。
{ {
"log": {}, "log": {},
"dns": {}, "dns": {},
"inbounds": [], "inbounds": {},
"outbounds": [], "outbounds": {},
"route": {}, "route": {},
"experimental": {} "experimental": {}
} }

View File

@@ -1,5 +1,3 @@
# Log
### Structure ### Structure
```json ```json

View File

@@ -1,5 +1,3 @@
# 日志
### 结构 ### 结构
```json ```json

View File

@@ -4,8 +4,12 @@
```json ```json
{ {
"type": "block", "outbounds": [
"tag": "block" {
"type": "block",
"tag": "block"
}
]
} }
``` ```

View File

@@ -4,8 +4,12 @@
```json ```json
{ {
"type": "block", "outbounds": [
"tag": "block" {
"type": "block",
"tag": "block"
}
]
} }
``` ```

View File

@@ -4,18 +4,30 @@
```json ```json
{ {
"type": "direct", "outbounds": [
"tag": "direct-out", {
"type": "direct",
"tag": "direct-out",
"override_address": "1.0.0.1", "override_address": "1.0.0.1",
"override_port": 53, "override_port": 53,
"proxy_protocol": 0, "proxy_protocol": 0,
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### Fields ### Direct Fields
#### override_address #### override_address
@@ -33,4 +45,54 @@ Protocol value can be `1` or `2`.
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before connect.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -4,18 +4,30 @@
```json ```json
{ {
"type": "direct", "outbounds": [
"tag": "direct-out", {
"type": "direct",
"tag": "direct-out",
"override_address": "1.0.0.1", "override_address": "1.0.0.1",
"override_port": 53, "override_port": 53,
"proxy_protocol": 0, "proxy_protocol": 0,
... // 拨号字段 "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### 字段 ### Direct 字段
#### override_address #### override_address
@@ -33,4 +45,51 @@
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,域名将在请求发出之前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -4,8 +4,12 @@
```json ```json
{ {
"type": "dns", "outbounds": [
"tag": "dns-out" {
"type": "dns",
"tag": "dns-out"
}
]
} }
``` ```

View File

@@ -4,8 +4,12 @@
```json ```json
{ {
"type": "dns", "outbounds": [
"tag": "dns-out" {
"type": "dns",
"tag": "dns-out"
}
]
} }
``` ```

View File

@@ -4,20 +4,32 @@
```json ```json
{ {
"type": "http", "outbounds": [
"tag": "http-out", {
"type": "http",
"tag": "http-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"username": "sekai", "username": "sekai",
"password": "admin", "password": "admin",
"tls": {}, "tls": {},
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### Fields ### HTTP Fields
#### server #### server
@@ -45,4 +57,54 @@ TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -4,20 +4,32 @@
```json ```json
{ {
"type": "http", "outbounds": [
"tag": "http-out", {
"type": "http",
"tag": "http-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"username": "sekai", "username": "sekai",
"password": "admin", "password": "admin",
"tls": {}, "tls": {},
... // 拨号字段 "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### 字段 ### HTTP 字段
#### server #### server
@@ -45,4 +57,51 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -2,25 +2,37 @@
```json ```json
{ {
"type": "hysteria", "outbounds": [
"tag": "hysteria-out", {
"type": "hysteria",
"tag": "hysteria-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"up": "100 Mbps",
"up_mbps": 100,
"down": "100 Mbps",
"down_mbps": 100,
"obfs": "fuck me till the daylight",
"auth": "",
"auth_str": "password",
"recv_window_conn": 0,
"recv_window": 0,
"disable_mtu_discovery": false,
"network": "tcp",
"tls": {},
... // Dial Fields "up": "100 Mbps",
"up_mbps": 100,
"down": "100 Mbps",
"down_mbps": 100,
"obfs": "fuck me till the daylight",
"auth": "",
"auth_str": "password",
"recv_window_conn": 0,
"recv_window": 0,
"disable_mtu_discovery": false,
"network": "tcp",
"tls": {},
"detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
@@ -28,7 +40,7 @@
QUIC, which is required by hysteria is not included by default, see [Installation](/#installation). QUIC, which is required by hysteria is not included by default, see [Installation](/#installation).
### Fields ### Hysteria Fields
#### server #### server
@@ -113,4 +125,54 @@ Both is enabled by default.
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -2,33 +2,45 @@
```json ```json
{ {
"type": "hysteria", "outbounds": [
"tag": "hysteria-out", {
"type": "hysteria",
"tag": "hysteria-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"up": "100 Mbps",
"up_mbps": 100,
"down": "100 Mbps",
"down_mbps": 100,
"obfs": "fuck me till the daylight",
"auth": "",
"auth_str": "password",
"recv_window_conn": 0,
"recv_window": 0,
"disable_mtu_discovery": false,
"network": "tcp",
"tls": {},
... // 拨号字段 "up": "100 Mbps",
"up_mbps": 100,
"down": "100 Mbps",
"down_mbps": 100,
"obfs": "fuck me till the daylight",
"auth": "",
"auth_str": "password",
"recv_window_conn": 0,
"recv_window": 0,
"disable_mtu_discovery": false,
"network": "tcp",
"tls": {},
"detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
!!! warning "" !!! warning ""
默认安装不包含被 Hysteria 依赖的 QUIC参阅 [安装](/zh/#_2)。 默认安装不包含被 Hysteria 依赖的 QUIC参阅 [安装](/zh/#installation)。
### 字段 ### Hysteria 字段
#### server #### server
@@ -111,4 +123,51 @@ TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -1,5 +1,3 @@
# Outbound
### Structure ### Structure
```json ```json

View File

@@ -2,15 +2,19 @@
```json ```json
{ {
"type": "selector",
"tag": "select",
"outbounds": [ "outbounds": [
"proxy-a", {
"proxy-b", "type": "selector",
"proxy-c" "tag": "select",
],
"default": "proxy-c" "outbounds": [
"proxy-a",
"proxy-b",
"proxy-c"
],
"default": "proxy-c"
}
]
} }
``` ```

View File

@@ -2,15 +2,19 @@
```json ```json
{ {
"type": "selector",
"tag": "select",
"outbounds": [ "outbounds": [
"proxy-a", {
"proxy-b", "type": "selector",
"proxy-c" "tag": "select",
],
"default": "proxy-c" "outbounds": [
"proxy-a",
"proxy-b",
"proxy-c"
],
"default": "proxy-c"
}
]
} }
``` ```

View File

@@ -2,22 +2,34 @@
```json ```json
{ {
"type": "shadowsocks", "outbounds": [
"tag": "ss-out", {
"type": "shadowsocks",
"tag": "ss-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"method": "2022-blake3-aes-128-gcm", "method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg==", "password": "8JCsPssfgS8tiRwiMlhARg==",
"network": "udp", "network": "udp",
"udp_over_tcp": false, "udp_over_tcp": false,
"multiplex": {}, "multiplex": {},
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### Fields ### Shadowsocks Fields
#### server #### server
@@ -85,4 +97,54 @@ Multiplex configuration, see [Multiplex](/configuration/shared/multiplex).
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -1,23 +1,35 @@
### 结构 ### Structure
```json ```json
{ {
"type": "shadowsocks", "outbounds": [
"tag": "ss-out", {
"type": "shadowsocks",
"tag": "ss-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"method": "2022-blake3-aes-128-gcm", "method": "2022-blake3-aes-128-gcm",
"password": "8JCsPssfgS8tiRwiMlhARg==", "password": "8JCsPssfgS8tiRwiMlhARg==",
"network": "udp", "network": "udp",
"udp_over_tcp": false, "udp_over_tcp": false,
"multiplex": {}, "multiplex": {},
... // 拨号字段 "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### 字段 ### Shadowsocks 字段
#### server #### server
@@ -85,4 +97,51 @@ Shadowsocks 密码。
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -1,38 +0,0 @@
### Structure
```json
{
"type": "shadowtls",
"tag": "st-out",
"server": "127.0.0.1",
"server_port": 1080,
"tls": {},
... // Dial Fields
}
```
### Fields
#### server
==Required==
The server address.
#### server_port
==Required==
The server port.
#### tls
==Required==
TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details.

View File

@@ -1,38 +0,0 @@
### 结构
```json
{
"type": "shadowtls",
"tag": "st-out",
"server": "127.0.0.1",
"server_port": 1080,
"tls": {},
... // 拨号字段
}
```
### 字段
#### server
==必填==
服务器地址。
#### server_port
==必填==
服务器端口。
#### tls
==必填==
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。

View File

@@ -4,22 +4,34 @@
```json ```json
{ {
"type": "socks", "outbounds": [
"tag": "socks-out", {
"type": "socks",
"tag": "socks-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"version": "5", "version": "5",
"username": "sekai", "username": "sekai",
"password": "admin", "password": "admin",
"network": "udp", "network": "udp",
"udp_over_tcp": false, "udp_over_tcp": false,
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### Fields ### SOCKS Fields
#### server #### server
@@ -61,4 +73,54 @@ Enable the UDP over TCP protocol.
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -1,25 +1,37 @@
`socks` 出站是 socks4/socks4a/socks5 客户端 `socks` 出站是 socks4/socks4a/socks5 客户端
### 结构 ### Structure
```json ```json
{ {
"type": "socks", "outbounds": [
"tag": "socks-out", {
"type": "socks",
"tag": "socks-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"version": "5", "version": "5",
"username": "sekai", "username": "sekai",
"password": "admin", "password": "admin",
"network": "udp", "network": "udp",
"udp_over_tcp": false, "udp_over_tcp": false,
... // 拨号字段 "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### 字段 ### SOCKS 字段
#### server #### server
@@ -61,4 +73,51 @@ SOCKS5 密码。
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -2,24 +2,36 @@
```json ```json
{ {
"type": "ssh", "outbounds": [
"tag": "ssh-out", {
"type": "ssh",
"tag": "ssh-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 22, "server_port": 22,
"user": "root", "user": "root",
"password": "admin", "password": "admin",
"private_key": "", "private_key": "",
"private_key_path": "$HOME/.ssh/id_rsa", "private_key_path": "$HOME/.ssh/id_rsa",
"private_key_passphrase": "", "private_key_passphrase": "",
"host_key_algorithms": [], "host_key_algorithms": [],
"client_version": "SSH-2.0-OpenSSH_7.4p1", "client_version": "SSH-2.0-OpenSSH_7.4p1",
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### Fields ### SSH Fields
#### server #### server
@@ -61,4 +73,54 @@ Client version. Random version will be used if empty.
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -1,25 +1,37 @@
### 结构 ### Structure
```json ```json
{ {
"type": "ssh", "outbounds": [
"tag": "ssh-out", {
"type": "ssh",
"tag": "ssh-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 22, "server_port": 22,
"user": "root", "user": "root",
"password": "admin", "password": "admin",
"private_key": "", "private_key": "",
"private_key_path": "$HOME/.ssh/id_rsa", "private_key_path": "$HOME/.ssh/id_rsa",
"private_key_passphrase": "", "private_key_passphrase": "",
"host_key_algorithms": [], "host_key_algorithms": [],
"client_version": "SSH-2.0-OpenSSH_7.4p1", "client_version": "SSH-2.0-OpenSSH_7.4p1",
... // 拨号字段 "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### 字段 ### SSH 字段
#### server #### server
@@ -61,4 +73,51 @@ SSH 用户, 默认使用 root。
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -2,17 +2,29 @@
```json ```json
{ {
"type": "tor", "outbounds": [
"tag": "tor-out", {
"type": "tor",
"tag": "tor-out",
"executable_path": "/usr/bin/tor", "executable_path": "/usr/bin/tor",
"extra_args": [], "extra_args": [],
"data_directory": "$HOME/.cache/tor", "data_directory": "$HOME/.cache/tor",
"torrc": { "torrc": {
"ClientOnly": 1 "ClientOnly": 1
}, },
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
@@ -20,7 +32,7 @@
Embedded tor is not included by default, see [Installation](/#installation). Embedded tor is not included by default, see [Installation](/#installation).
### Fields ### Tor Fields
#### executable_path #### executable_path
@@ -44,8 +56,58 @@ Each start will be very slow if not specified.
Map of torrc options. Map of torrc options.
See [tor(1)](https://linux.die.net/man/1/tor) for details. See [tor(1)](https://linux.die.net/man/1/tor)
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -2,25 +2,37 @@
```json ```json
{ {
"type": "tor", "outbounds": [
"tag": "tor-out", {
"type": "tor",
"tag": "tor-out",
"executable_path": "/usr/bin/tor", "executable_path": "/usr/bin/tor",
"extra_args": [], "extra_args": [],
"data_directory": "$HOME/.cache/tor", "data_directory": "$HOME/.cache/tor",
"torrc": { "torrc": {
"ClientOnly": 1 "ClientOnly": 1
}, },
... // 拨号字段 "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
!!! info "" !!! info ""
默认安装不包含嵌入式 Tor, 参阅 [安装](/zh/#_2)。 默认安装不包含嵌入式 Tor, 参阅 [安装](/zh/#installation)。
### 字段 ### Tor 字段
#### executable_path #### executable_path
@@ -48,4 +60,51 @@ torrc 参数表。
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -2,22 +2,34 @@
```json ```json
{ {
"type": "trojan", "outbounds": [
"tag": "trojan-out", {
"type": "trojan",
"tag": "trojan-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"password": "8JCsPssfgS8tiRwiMlhARg==", "password": "8JCsPssfgS8tiRwiMlhARg==",
"network": "tcp", "network": "tcp",
"tls": {}, "tls": {},
"multiplex": {}, "multiplex": {},
"transport": {}, "transport": {},
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### Fields ### Trojan Fields
#### server #### server
@@ -59,4 +71,54 @@ V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -2,22 +2,34 @@
```json ```json
{ {
"type": "trojan", "outbounds": [
"tag": "trojan-out", {
"type": "trojan",
"tag": "trojan-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"password": "8JCsPssfgS8tiRwiMlhARg==", "password": "8JCsPssfgS8tiRwiMlhARg==",
"network": "tcp", "network": "tcp",
"tls": {}, "tls": {},
"multiplex": {}, "multiplex": {},
"transport": {}, "transport": {},
... // 拨号字段 "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### 字段 ### Trojan 字段
#### server #### server
@@ -59,4 +71,51 @@ V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-tra
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -2,27 +2,38 @@
```json ```json
{ {
"type": "vmess", "outbounds": [
"tag": "vmess-out", {
"type": "vmess",
"tag": "vmess-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"uuid": "bf000d23-0752-40b4-affe-68f7707a9661", "uuid": "bf000d23-0752-40b4-affe-68f7707a9661",
"security": "auto", "security": "auto",
"alter_id": 0, "alter_id": 0,
"global_padding": false, "global_padding": false,
"authenticated_length": true, "authenticated_length": true,
"network": "tcp", "network": "tcp",
"tls": {}, "tls": {},
"packet_addr": false, "multiplex": {},
"multiplex": {}, "transport": {},
"transport": {},
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### Fields ### VMess Fields
#### server #### server
@@ -84,10 +95,6 @@ Both is enabled by default.
TLS configuration, see [TLS](/configuration/shared/tls/#outbound). TLS configuration, see [TLS](/configuration/shared/tls/#outbound).
#### packet_addr
Enable packetaddr support.
#### multiplex #### multiplex
Multiplex configuration, see [Multiplex](/configuration/shared/multiplex). Multiplex configuration, see [Multiplex](/configuration/shared/multiplex).
@@ -98,4 +105,54 @@ V2Ray Transport configuration, see [V2Ray Transport](/configuration/shared/v2ray
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -2,27 +2,36 @@
```json ```json
{ {
"type": "vmess", "outbounds": [
"tag": "vmess-out", {
"type": "vmess",
"server": "127.0.0.1", "tag": "vmess-out",
"server_port": 1080, "server": "127.0.0.1",
"uuid": "bf000d23-0752-40b4-affe-68f7707a9661", "server_port": 1080,
"security": "auto", "uuid": "bf000d23-0752-40b4-affe-68f7707a9661",
"alter_id": 0, "security": "auto",
"global_padding": false, "alter_id": 0,
"authenticated_length": true, "global_padding": false,
"network": "tcp", "authenticated_length": true,
"tls": {}, "network": "tcp",
"packet_addr": false, "tls": {},
"multiplex": {}, "multiplex": {},
"transport": {}, "transport": {},
"detour": "upstream-out",
... // 拨号字段 "bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
### 字段 ### VMess 字段
#### server #### server
@@ -84,10 +93,6 @@ VMess 用户 ID。
TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。 TLS 配置, 参阅 [TLS](/zh/configuration/shared/tls/#outbound)。
#### packet_addr
启用 packetaddr 支持。
#### multiplex #### multiplex
多路复用配置, 参阅 [多路复用](/zh/configuration/shared/multiplex)。 多路复用配置, 参阅 [多路复用](/zh/configuration/shared/multiplex)。
@@ -98,4 +103,51 @@ V2Ray 传输配置,参阅 [V2Ray 传输层](/zh/configuration/shared/v2ray-tra
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -2,22 +2,34 @@
```json ```json
{ {
"type": "wireguard", "outbounds": [
"tag": "wireguard-out", {
"type": "wireguard",
"tag": "wireguard-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"local_address": [ "local_address": [
"10.0.0.1", "10.0.0.1",
"10.0.0.2/32" "10.0.0.2/32"
], ],
"private_key": "YNXtAzepDqRv9H52osJVDQnznT5AM11eCK3ESpwSt04=", "private_key": "YNXtAzepDqRv9H52osJVDQnznT5AM11eCK3ESpwSt04=",
"peer_public_key": "Z1XXLsKYkYxuiYjJIkRvtIKFepCYHTgON+GwPq7SOV4=", "peer_public_key": "Z1XXLsKYkYxuiYjJIkRvtIKFepCYHTgON+GwPq7SOV4=",
"pre_shared_key": "31aIhAPwktDGpH4JDhA8GNvjFXEf/a6+UaQRyOAiyfM=", "pre_shared_key": "31aIhAPwktDGpH4JDhA8GNvjFXEf/a6+UaQRyOAiyfM=",
"mtu": 1408, "mtu": 1408,
"network": "tcp", "network": "tcp",
... // Dial Fields "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
@@ -25,7 +37,7 @@
WireGuard is not included by default, see [Installation](/#installation). WireGuard is not included by default, see [Installation](/#installation).
### Fields ### WireGuard Fields
#### server #### server
@@ -80,4 +92,54 @@ Both is enabled by default.
### Dial Fields ### Dial Fields
See [Dial Fields](/configuration/shared/dial) for details. #### detour
The tag of the upstream outbound.
Other dial fields will be ignored when enabled.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the server domain name will be resolved to IP before connecting.
`dns.strategy` will be used if empty.
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for IPv6 to succeed before assuming
that IPv6 is misconfigured and falling back to IPv4 if `prefer_ipv4` is set.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is `prefer_ipv4` or `prefer_ipv6`.

View File

@@ -2,30 +2,42 @@
```json ```json
{ {
"type": "wireguard", "outbounds": [
"tag": "wireguard-out", {
"type": "wireguard",
"tag": "wireguard-out",
"server": "127.0.0.1", "server": "127.0.0.1",
"server_port": 1080, "server_port": 1080,
"local_address": [ "local_address": [
"10.0.0.1", "10.0.0.1",
"10.0.0.2/32" "10.0.0.2/32"
], ],
"private_key": "YNXtAzepDqRv9H52osJVDQnznT5AM11eCK3ESpwSt04=", "private_key": "YNXtAzepDqRv9H52osJVDQnznT5AM11eCK3ESpwSt04=",
"peer_public_key": "Z1XXLsKYkYxuiYjJIkRvtIKFepCYHTgON+GwPq7SOV4=", "peer_public_key": "Z1XXLsKYkYxuiYjJIkRvtIKFepCYHTgON+GwPq7SOV4=",
"pre_shared_key": "31aIhAPwktDGpH4JDhA8GNvjFXEf/a6+UaQRyOAiyfM=", "pre_shared_key": "31aIhAPwktDGpH4JDhA8GNvjFXEf/a6+UaQRyOAiyfM=",
"mtu": 1408, "mtu": 1408,
"network": "tcp", "network": "tcp",
... // 拨号字段 "detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
]
} }
``` ```
!!! warning "" !!! warning ""
默认安装不包含 WireGuard, 参阅 [安装](/zh/#_2)。 默认安装不包含 WireGuard, 参阅 [安装](/zh/#installation)。
### 字段 ### WireGuard 字段
#### server #### server
@@ -82,4 +94,51 @@ WireGuard MTU。 默认1408。
### 拨号字段 ### 拨号字段
参阅 [拨号字段](/zh/configuration/shared/dial/)。 #### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,服务器域名将在连接前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

View File

@@ -1,5 +1,3 @@
# Route
### Structure ### Structure
```json ```json

View File

@@ -41,12 +41,10 @@
"cn" "cn"
], ],
"source_ip_cidr": [ "source_ip_cidr": [
"10.0.0.0/24", "10.0.0.0/24"
"192.168.0.1"
], ],
"ip_cidr": [ "ip_cidr": [
"10.0.0.0/24", "10.0.0.0/24"
"192.168.0.1"
], ],
"source_port": [ "source_port": [
12345 12345
@@ -68,9 +66,6 @@
"process_name": [ "process_name": [
"curl" "curl"
], ],
"process_path": [
"/usr/bin/curl"
],
"package_name": [ "package_name": [
"com.termux" "com.termux"
], ],
@@ -191,14 +186,6 @@ Match port range.
Match process name. Match process name.
#### process_path
!!! error ""
Only supported on Linux, Windows, and macOS.
Match process path.
#### package_name #### package_name
Match android package name. Match android package name.

View File

@@ -66,9 +66,6 @@
"process_name": [ "process_name": [
"curl" "curl"
], ],
"process_path": [
"/usr/bin/curl"
],
"package_name": [ "package_name": [
"com.termux" "com.termux"
], ],
@@ -189,14 +186,6 @@
匹配进程名称。 匹配进程名称。
#### process_path
!!! error ""
仅支持 Linux、Windows 和 macOS.
匹配进程路径。
#### package_name #### package_name
匹配 Android 应用包名。 匹配 Android 应用包名。

View File

@@ -1,74 +0,0 @@
### Structure
```json
{
"detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
```
### Fields
| Field | Available Context |
|-----------------------------------------------------------------------------------|-------------------|
| `bind_interface` /`bind_address` /`routing_mark` /`reuse_addr` /`connect_timeout` | `detour` not set |
#### detour
The tag of the upstream outbound.
#### bind_interface
The network interface to bind to.
#### bind_address
The address to bind to.
#### routing_mark
!!! error ""
Only supported on Linux.
Set netfilter routing mark.
#### reuse_addr
Reuse listener address.
#### connect_timeout
Connect timeout, in golang's Duration format.
A duration string is a possibly signed sequence of
decimal numbers, each with optional fraction and a unit suffix,
such as "300ms", "-1.5h" or "2h45m".
Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
#### domain_strategy
One of `prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`.
If set, the requested domain name will be resolved to IP before connect.
| Outbound | Effected domains | Fallback Value |
|----------|--------------------------|-------------------------------------------|
| `direct` | Domain in request | Take `inbound.domain_strategy` if not set |
| others | Domain in server address | / |
#### fallback_delay
The length of time to wait before spawning a RFC 6555 Fast Fallback connection.
That is, is the amount of time to wait for connection to succeed before assuming
that IPv4/IPv6 is misconfigured and falling back to other type of addresses.
If zero, a default delay of 300ms is used.
Only take effect when `domain_strategy` is set.

View File

@@ -1,66 +0,0 @@
### 结构
```json
{
"detour": "upstream-out",
"bind_interface": "en0",
"bind_address": "0.0.0.0",
"routing_mark": 1234,
"reuse_addr": false,
"connect_timeout": "5s",
"tcp_fast_open": false,
"domain_strategy": "prefer_ipv6",
"fallback_delay": "300ms"
}
```
### 字段
#### detour
上游出站的标签。
启用时,其他拨号字段将被忽略。
#### bind_interface
要绑定到的网络接口。
#### bind_address
要绑定的地址。
#### routing_mark
!!! error ""
仅支持 Linux。
设置 netfilter 路由标记。
#### reuse_addr
重用监听地址。
#### connect_timeout
连接超时,采用 golang 的 Duration 格式。
持续时间字符串是一个可能有符号的序列十进制数,每个都有可选的分数和单位后缀, 例如 "300ms"、"-1.5h" 或 "2h45m"。
有效时间单位为 "ns"、"us"(或 "µs")、"ms"、"s"、"m"、"h"。
#### domain_strategy
可选值:`prefer_ipv4` `prefer_ipv6` `ipv4_only` `ipv6_only`
如果设置,域名将在请求发出之前解析为 IP。
默认使用 `dns.strategy`
#### fallback_delay
在生成 RFC 6555 快速回退连接之前等待的时间长度。
也就是说,是在假设之前等待 IPv6 成功的时间量如果设置了 "prefer_ipv4",则 IPv6 配置错误并回退到 IPv4。
如果为零,则使用 300 毫秒的默认延迟。
仅当 `domain_strategy``prefer_ipv4``prefer_ipv6` 时生效。

Some files were not shown because too many files have changed in this diff Show More