Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

documentation: Improve readability of navigation sidebar #2270

Open
wants to merge 39 commits into
base: dev-next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
7f65ab8
Crazy sekai overturns the small pond
nekohasekai Oct 21, 2024
c2b833a
Implement TCP and ICMP rejects
nekohasekai Oct 22, 2024
5eb8522
Implement resolve(server)
nekohasekai Oct 22, 2024
e45763d
Implement dns-hijack
nekohasekai Oct 23, 2024
776052d
refactor: Modular inbounds/outbounds
nekohasekai Nov 1, 2024
866be4a
Remove unused reject methods
nekohasekai Nov 6, 2024
3a3ad11
Improve rule actions
nekohasekai Nov 6, 2024
b75dbc8
Implement new deprecated warnings
nekohasekai Nov 7, 2024
85f634d
Implement udp connect
nekohasekai Nov 7, 2024
1a230bd
Migrate bad options to library
nekohasekai Nov 7, 2024
24496d8
documentation: Remove outdated icons
nekohasekai Nov 6, 2024
b8613de
documentation: Update the scheduled removal time of deprecated features
nekohasekai Nov 6, 2024
44560f0
documentation: Add rule action
nekohasekai Nov 6, 2024
1ee7a4a
documentation: Bump version
nekohasekai Nov 6, 2024
beaab2e
refactor: Modular inbound/outbound manager
nekohasekai Nov 9, 2024
1df8dfc
refactor: Modular network manager
nekohasekai Nov 10, 2024
b4f1c2a
refactor: Extract clash/v2ray/time service form router
nekohasekai Nov 10, 2024
7daf2d1
Fix hijack-dns
nekohasekai Nov 10, 2024
e3ffffc
documentation: Bump version
nekohasekai Nov 10, 2024
1edb80a
Fix start stage
nekohasekai Nov 11, 2024
b6c940a
Fix match rules
nekohasekai Nov 11, 2024
412701d
refactor: Platform Interfaces
nekohasekai Nov 11, 2024
9988144
Fix decompile rule-set
nekohasekai Nov 11, 2024
ef2a2fd
Merge route options to route actions
nekohasekai Nov 11, 2024
aa35ae1
Add `network_[type/is_expensive/is_constrained]` rule items
nekohasekai Nov 11, 2024
c59f282
documentation: Merge route options to route actions
nekohasekai Nov 11, 2024
d8e66b9
documentation: Add new rule item types
nekohasekai Nov 11, 2024
26064a9
documentation: Bump version
nekohasekai Nov 11, 2024
0d1b322
Fix match rules
nekohasekai Nov 12, 2024
c0e48f8
documentation: Bump version
nekohasekai Nov 12, 2024
7f99cab
Downgrade NDK to 26.2.11394342
nekohasekai Nov 12, 2024
edf40da
Fix check interface
nekohasekai Nov 12, 2024
8cb11bf
Fix rule match
nekohasekai Nov 13, 2024
f361c83
Add multi network dialing
nekohasekai Nov 12, 2024
2baf38a
documentation: Remove unused titles
nekohasekai Nov 12, 2024
81e49b5
documentation: Add parallel network dialing
nekohasekai Nov 12, 2024
353cf6b
documentation: Bump version
nekohasekai Nov 12, 2024
632782c
documentation: Introduce page `status`
zacred0rryn Nov 12, 2024
f9f2573
documentation: Replace page `icon` with page `status`
zacred0rryn Nov 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
104 changes: 0 additions & 104 deletions adapter/conn_router.go

This file was deleted.

30 changes: 8 additions & 22 deletions adapter/experimental.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,28 @@ import (
"bytes"
"context"
"encoding/binary"
"net"
"time"

"github.com/sagernet/sing-box/common/urltest"
"github.com/sagernet/sing-dns"
N "github.com/sagernet/sing/common/network"
"github.com/sagernet/sing/common/varbin"
)

type ClashServer interface {
Service
PreStarter
LifecycleService
ConnectionTracker
Mode() string
ModeList() []string
HistoryStorage() *urltest.HistoryStorage
RoutedConnection(ctx context.Context, conn net.Conn, metadata InboundContext, matchedRule Rule) (net.Conn, Tracker)
RoutedPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext, matchedRule Rule) (N.PacketConn, Tracker)
}

type V2RayServer interface {
LifecycleService
StatsService() ConnectionTracker
}

type CacheFile interface {
Service
PreStarter
LifecycleService

StoreFakeIP() bool
FakeIPStorage
Expand Down Expand Up @@ -94,10 +94,6 @@ func (s *SavedRuleSet) UnmarshalBinary(data []byte) error {
return nil
}

type Tracker interface {
Leave()
}

type OutboundGroup interface {
Outbound
Now() string
Expand All @@ -115,13 +111,3 @@ func OutboundTag(detour Outbound) string {
}
return detour.Tag()
}

type V2RayServer interface {
Service
StatsService() V2RayStatsService
}

type V2RayStatsService interface {
RoutedConnection(inbound string, outbound string, user string, conn net.Conn) net.Conn
RoutedPacketConnection(inbound string, outbound string, user string, conn N.PacketConn) N.PacketConn
}
26 changes: 26 additions & 0 deletions adapter/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,53 @@ import (

"github.com/sagernet/sing/common/buf"
E "github.com/sagernet/sing/common/exceptions"
M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network"
)

// Deprecated
type ConnectionHandler interface {
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
}

type ConnectionHandlerEx interface {
NewConnectionEx(ctx context.Context, conn net.Conn, metadata InboundContext, onClose N.CloseHandlerFunc)
}

// Deprecated: use PacketHandlerEx instead
type PacketHandler interface {
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, metadata InboundContext) error
}

type PacketHandlerEx interface {
NewPacketEx(buffer *buf.Buffer, source M.Socksaddr)
}

// Deprecated: use OOBPacketHandlerEx instead
type OOBPacketHandler interface {
NewPacket(ctx context.Context, conn N.PacketConn, buffer *buf.Buffer, oob []byte, metadata InboundContext) error
}

type OOBPacketHandlerEx interface {
NewPacketEx(buffer *buf.Buffer, oob []byte, source M.Socksaddr)
}

// Deprecated
type PacketConnectionHandler interface {
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
}

type PacketConnectionHandlerEx interface {
NewPacketConnectionEx(ctx context.Context, conn N.PacketConn, metadata InboundContext, onClose N.CloseHandlerFunc)
}

type UpstreamHandlerAdapter interface {
N.TCPConnectionHandler
N.UDPConnectionHandler
E.Handler
}

type UpstreamHandlerAdapterEx interface {
N.TCPConnectionHandlerEx
N.UDPConnectionHandlerEx
}
46 changes: 36 additions & 10 deletions adapter/inbound.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package adapter

import (
"context"
"net"
"net/netip"
"time"

"github.com/sagernet/sing-box/common/process"
C "github.com/sagernet/sing-box/constant"
"github.com/sagernet/sing-box/log"
"github.com/sagernet/sing-box/option"
M "github.com/sagernet/sing/common/metadata"
N "github.com/sagernet/sing/common/network"
)

type Inbound interface {
Expand All @@ -17,11 +18,27 @@ type Inbound interface {
Tag() string
}

type InjectableInbound interface {
type TCPInjectableInbound interface {
Inbound
Network() []string
NewConnection(ctx context.Context, conn net.Conn, metadata InboundContext) error
NewPacketConnection(ctx context.Context, conn N.PacketConn, metadata InboundContext) error
ConnectionHandlerEx
}

type UDPInjectableInbound interface {
Inbound
PacketConnectionHandlerEx
}

type InboundRegistry interface {
option.InboundOptionsRegistry
Create(ctx context.Context, router Router, logger log.ContextLogger, tag string, inboundType string, options any) (Inbound, error)
}

type InboundManager interface {
Lifecycle
Inbounds() []Inbound
Get(tag string) (Inbound, bool)
Remove(tag string) error
Create(ctx context.Context, router Router, logger log.ContextLogger, tag string, inboundType string, options any) error
}

type InboundContext struct {
Expand All @@ -43,10 +60,19 @@ type InboundContext struct {

// cache

InboundDetour string
LastInbound string
OriginDestination M.Socksaddr
InboundOptions option.InboundOptions
// Deprecated: implement in rule action
InboundDetour string
LastInbound string
OriginDestination M.Socksaddr
// Deprecated
InboundOptions option.InboundOptions
UDPDisableDomainUnmapping bool
UDPConnect bool
NetworkStrategy C.NetworkStrategy
FallbackDelay time.Duration

DNSServer string

DestinationAddresses []netip.Addr
SourceGeoIPCode string
GeoIPCode string
Expand Down
21 changes: 21 additions & 0 deletions adapter/inbound/adapter.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package inbound

type Adapter struct {
inboundType string
inboundTag string
}

func NewAdapter(inboundType string, inboundTag string) Adapter {
return Adapter{
inboundType: inboundType,
inboundTag: inboundTag,
}
}

func (a *Adapter) Type() string {
return a.inboundType
}

func (a *Adapter) Tag() string {
return a.inboundTag
}
Loading