adapter

package
v3.0.0-...-1f68d82 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 9, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInjectionRequired = errors.New("injection required")

Functions

func DialContextWithMetadata

func DialContextWithMetadata(dialer network.Dialer, ctx context.Context, network, addr string, metadata *Metadata) (net.Conn, error)

Types

type InjectOutbound

type InjectOutbound interface {
	InjectConnection(ctx context.Context, conn *bufio.CachedConn, metadata *Metadata) error
}

type Metadata

type Metadata struct {
	ConnectionID        string
	ServiceName         string
	SniffedProtocol     Protocol
	SourceAddress       netip.AddrPort
	DestinationHostname string
	DestinationPort     uint16
	SRV                 *SRVMetadata
	Minecraft           *MinecraftMetadata
	TLS                 *TLSMetadata
	Custom              map[string]any
}

func (*Metadata) GenerateID

func (m *Metadata) GenerateID()

type MetadataOutbound

type MetadataOutbound interface {
	DialContextWithMetadata(ctx context.Context, network string, address string, metadata *Metadata) (net.Conn, error)
}

type MinecraftMetadata

type MinecraftMetadata struct {
	ProtocolVersion      uint
	PlayerName           string
	OriginDestination    string
	RewrittenDestination string

	OriginPort    uint16
	RewrittenPort uint16
	UUID          [16]byte
	NextState     int8
	SniffPosition int
	// contains filtered or unexported fields
}

func (*MinecraftMetadata) CleanOriginDestination

func (m *MinecraftMetadata) CleanOriginDestination() (clean string)

func (*MinecraftMetadata) FMLMarkup

func (m *MinecraftMetadata) FMLMarkup() string

func (*MinecraftMetadata) IsFML

func (m *MinecraftMetadata) IsFML() bool

type Outbound

type Outbound interface {
	Name() string
	PostInitialize(router Router) error
	Reload(newConfig *config.Outbound) error
	DialContext(ctx context.Context, network string, address string) (net.Conn, error)
}

type Protocol

type Protocol = uint8

type Router

type Router interface {
	FindOutboundByName(name string) (Outbound, error)
	FindListsByTag(tags []string) ([]set.StringSet, error)
	HandleConnection(conn net.Conn, metadata *Metadata)
}

type SRVMetadata

type SRVMetadata struct {
	ServiceName string
}

type SRVOutbound

type SRVOutbound interface {
	DialContextWithSRV(ctx context.Context, network string, address string, serviceName string) (net.Conn, error)
}

type Service

type Service interface {
	Start(ctx context.Context) error
	Reload(ctx context.Context, newConfig *config.Service) error
	UpdateRouter(router Router)
	io.Closer
}

type TLSMetadata

type TLSMetadata struct {
	SNI string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL