server

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2021 License: AGPL-3.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const LostThreshold = 5 * time.Minute

Variables

View Source
var Mapper = make(map[string]Creator)
View Source
var (
	// ProtectTime is the cooling time of a client IP changing for the same passage
	ProtectTime = map[PassageUse]time.Duration{
		PassageUseUser:    0,
		PassageUseRelay:   90 * time.Second,
		PassageUseManager: 300 * time.Second,
	}
)

Functions

func Register

func Register(name string, c Creator)

func SyncPassages

func SyncPassages(s Server, passages []Passage) (err error)

Types

type Argument

type Argument struct {
	Ticket string

	Name string
	Host string
	Port int
}

type ContentionCache

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

func NewContentionCache

func NewContentionCache() *ContentionCache

func (*ContentionCache) Check

func (c *ContentionCache) Check(key string, protectTime time.Duration, ip net.IP) (accept bool, conflictIP net.IP)

Check return if the IP should be allowed for the key.

type ContentionCountdown

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

type Creator

type Creator func(sweetLisaHost config.Lisa, arg Argument) (Server, error)

type Passage

type Passage struct {
	Manager bool
	model.Passage
}

type PassageUse

type PassageUse string
const (
	PassageUseUser    PassageUse = "user"
	PassageUseRelay   PassageUse = "relay"
	PassageUseManager PassageUse = "manager"
)

type Server

type Server interface {
	Listen(addr string) (err error)
	AddPassages(passages []Passage) (err error)
	RemovePassages(passages []Passage, alsoManager bool) (err error)
	SyncPassages(passages []Passage) (err error)
	Passages() (passages []Passage)
	io.Closer
}

func NewServer

func NewServer(protocol string, sweetLisaHost config.Lisa, arg Argument) (Server, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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