ss

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug *log.Logger
	Info  *log.Logger
	Error *log.Logger
)

Functions

func SetLog

func SetLog(debug, info, err *log.Logger)

Types

type Dialer

type Dialer interface {
	Dial(network, addr string) (c net.Conn, err error)
}

type Manager

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

func NewManager

func NewManager(minPort, maxPort int) *Manager

func (*Manager) Add

func (m *Manager) Add(port int, method, password string, opts ...OptionHandler) (*SS, error)

func (*Manager) Del

func (m *Manager) Del(port int) error

Del delete ss by port

func (*Manager) Get

func (m *Manager) Get(port int) (*SS, error)

func (*Manager) GetAll

func (m *Manager) GetAll() []*SS

GetAll get all ss

func (*Manager) GetAllByMethod

func (m *Manager) GetAllByMethod(method string) []*SS

GetAllByMethod get all ss by method

func (*Manager) SetHost

func (m *Manager) SetHost(host string)

SetHost set host

type Option

type Option struct {
	SendRateLimit uint64
	RecvRateLimit uint64
}

type OptionHandler

type OptionHandler func(*Option)

func WithRateLimit added in v1.0.2

func WithRateLimit(send, recv uint64) OptionHandler

type SS

type SS struct {
	Server   string `json:"server"`
	Port     int    `json:"server_port"`
	Method   string `json:"method"`
	Password string `json:"password"`
	// contains filtered or unexported fields
}

SS is a sadowsocks instance manager

func NewSS

func NewSS(server string, port int, method, password string, dialer Dialer) *SS

NewSS return a new SS pointer

func (*SS) ExportJson

func (ss *SS) ExportJson() []byte

ExportJson export ss server info to json

func (*SS) ExportURL

func (ss *SS) ExportURL() string

ExportURL export ss server info to url

func (*SS) RunTCP

func (ss *SS) RunTCP() error

RunTCP run ss server on tcp, use localAddr as source ip

func (*SS) RunUDP

func (ss *SS) RunUDP() error

RunUDP Listen on addr for encrypted packets and basically do UDP NAT.

func (*SS) SetRatelimit

func (ss *SS) SetRatelimit(tRate, rRate float64, tBurst, rBurst int64)

func (*SS) StopTCP

func (ss *SS) StopTCP() error

StopTCP stop ss server on tcp

func (*SS) StopUDP

func (ss *SS) StopUDP() error

type SSOption added in v1.0.2

type SSOption struct {
	EnableBlocklist      bool
	Blocklist            map[string]bool
	EnableTrafficControl bool
	TxBucket             *rate.Limiter
	RxBucket             *rate.Limiter
	EnablePeeper         bool
	Dialer               Dialer
}

type SSOptionHandler added in v1.0.2

type SSOptionHandler func(*SSOption)

Jump to

Keyboard shortcuts

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