sbox

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commongroup

type Commongroup struct {
	User string
	Pass string
}

type Inboud

type Inboud struct {
	Id              int64 //ID from json file
	Name            string
	Tag             string
	Type            string
	Option          *option.Inbound
	Support         []string
	ListenAddres    string
	Listenport      int
	Tlsenabled      bool
	Transporttype   string
	Transportoption option.V2RayTransportOptions
	Custom_info     string
	Domain          string
	PublicIp        string
}

Standar Inbound For Whole Aplication

func (*Inboud) Laddr

func (in *Inboud) Laddr() string

func (*Inboud) Port

func (in *Inboud) Port() int

func (*Inboud) TlsIsEnabled

func (in *Inboud) TlsIsEnabled() bool

func (*Inboud) TransortType

func (in *Inboud) TransortType() string

func (*Inboud) TransportPath

func (in *Inboud) TransportPath() string

type Outbound

type Outbound struct {
	Id          int64
	Name        string
	Tag         string
	Type        string
	Option      *option.Outbound
	Custom_info string
	Latency     *atomic.Int32
}

type Sboxcontroller

type Sboxcontroller interface {
	Start() error
	Close() error

	//Check If already user is in if not add the user
	//Should Calculate How much quota should added to underlaying sbox
	// Always update Usage to 0 when this called
	AddUser(*Userconfig) (Sboxstatus, error)
	AddUserReset(*Userconfig) (Sboxstatus, error)
	RemoveUser(*Userconfig) (Sboxstatus, error)
	RemoveAllRuleForuser(user string)
	//Do not going to update database using this func usage it will automaticaly doing by watchman
	//Userstatus
	GetstatusUser(*Userconfig) (Sboxstatus, error)

	GetAllInbound() ([]Inboud, error)
	AddInbound() error
	RemoveInboud() error
	InboundStatus(string) error

	GetAllOutbound() ([]Outbound, error)
	AddOutbound() error
	RemoveOutboud() error
	OutboundStatus(string) error

	ShareLinkEncode(*Userconfig, string) (string, error)

	SetLogChan(chan any)
	GetLogChan() chan any

	UrlTest(outtag string) (int16, error)
	RefreshUrlTest()

	CloseConns(suser *Userconfig) error
}

Xray Sing-box both should implement this

type Sboxstatus

type Sboxstatus struct {
	Download  C.Bwidth
	Upload    C.Bwidth
	Online_ip map[netip.Addr]int64
	Disabled  bool
}

func (Sboxstatus) FullUsage

func (s Sboxstatus) FullUsage() C.Bwidth

type Trojangroup

type Trojangroup struct {
	Password string
}

type Userconfig

type Userconfig struct {
	*Vlessgroup
	*Trojangroup
	*Commongroup
	DbID        int64
	UsercheckId int
	Name        string
	Usage       C.Bwidth
	Quota       C.Bwidth
	Inboundtag  string
	Outboundtag string
	LoginLimit  int32
	InboundId   int16
	OutboundID  int16
	TgId        int64 //user telegram id

	Type string

	Password string //optional other protocole like trojan

}

Standar config For Whole Aplication

func (*Userconfig) GetuniqName

func (u *Userconfig) GetuniqName() string

type Vlessgroup

type Vlessgroup struct {
	UUID uuid.UUID
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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