server

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package server orchestrates a shadowgate server: it owns the shared router (tun device + routing table) and starts the enabled transports (TCP, UDP, or both), which all route through that single router so clients on different transports can reach each other.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	TCPListen string // TCP listen address; empty disables TCP
	UDPListen string // UDP listen address; empty disables UDP
	Password  []byte
	Compress  bool   // TCP: Snappy-compress the stream
	Padding   int    // UDP: maximum random padding bytes per datagram
	Gateway   net.IP // client tunnel address to route otherwise-unroutable egress through; nil disables
	Timeout   time.Duration
}

Config selects which transports the server listens on and how they behave.

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(device tun.TUN, ip net.IP, network *net.IPNet, config Config) (*Server, error)

func (*Server) Close

func (self *Server) Close() error

func (*Server) Interface

func (self *Server) Interface() string

func (*Server) Run

func (self *Server) Run(signaling chan os.Signal) error

func (*Server) TCPAddress

func (self *Server) TCPAddress() net.Addr

TCPAddress reports the TCP listen address, or nil if TCP is disabled.

func (*Server) UDPAddress

func (self *Server) UDPAddress() net.Addr

UDPAddress reports the UDP listen address, or nil if UDP is disabled.

Jump to

Keyboard shortcuts

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