Documentation
¶
Index ¶
Constants ¶
View Source
const ( BucketServer = "server" MaxFailureCount = 10 )
View Source
const ( BucketTicket = "ticket" TicketLength = 52 )
View Source
const ( VerificationWaiting = iota VerificationDone )
View Source
const (
BucketFeed = "feed"
)
View Source
const BucketVerification = "verification"
Variables ¶
View Source
var VerificationExpiredErr = fmt.Errorf("verification expired")
Functions ¶
func GetFirstHost ¶
Types ¶
type Argument ¶
type Argument struct { // Required Protocol protocol.Protocol `json:",omitempty"` // Optional Username string `json:",omitempty"` // Required Password string `json:",omitempty"` // Optional Method string `json:",omitempty"` }
func GetRelayUserArgument ¶
func GetUserArgument ¶
type BandwidthLimit ¶
type BandwidthLimit struct { // Deprecated (only day is valid): ResetDay is the day of every month to reset the limit of bandwidth. Zero means never reset. // This field should only be updated by SweetLisa after the first setup. ResetDay time.Time `json:",omitempty"` // ResetMonth indicate if this month has reset. For example, if ResetMonth = 3, reset will not happen again in March. ResetMonth time.Month // UplinkLimitGiB is the limit of uplink bandwidth in GB (keep using "GiB" in name for compatibility). Zero means no limit. UplinkLimitGiB int64 `json:",omitempty"` // DownlinkLimitGiB is the limit of downlink bandwidth in GB (keep using "GiB" in name for compatibility). Zero means no limit. DownlinkLimitGiB int64 `json:",omitempty"` // TotalLimitGiB is the limit of downlink plus uplink bandwidth in GB (keep using "GiB" in name for compatibility). Zero means no limit. TotalLimitGiB int64 `json:",omitempty"` // UplinkKiB is the "transmit bytes" in /proc/net/dev of the biggest iface. UplinkKiB int64 `json:",omitempty"` // DownlinkKiB is the "receive bytes" in /proc/net/dev of the biggest iface. DownlinkKiB int64 `json:",omitempty"` // UplinkInitialKiB is the UplinkKiB at the beginning of the every cycles. UplinkInitialKiB int64 `json:",omitempty"` // DownlinkInitialKiB is the DownlinkKiB at the beginning of the every cycles. DownlinkInitialKiB int64 `json:",omitempty"` }
func (*BandwidthLimit) Exhausted ¶
func (l *BandwidthLimit) Exhausted() bool
func (*BandwidthLimit) IsTimeToReset ¶
func (l *BandwidthLimit) IsTimeToReset() bool
func (*BandwidthLimit) Reset ¶
func (l *BandwidthLimit) Reset()
func (*BandwidthLimit) Update ¶
func (l *BandwidthLimit) Update(r BandwidthLimit)
type PingResp ¶
type PingResp struct {
BandwidthLimit BandwidthLimit
}
type Server ¶
type Server struct { // Every server should have a server ticket, which should be included in each API interactions Ticket string // Name is also the proxy node name Name string // Hosts can be IPs and domains (split by ",") Hosts string `json:"Host"` // Port is shared by management and proxy Port int // Argument is used to connect and manage the server Argument Argument // BandwidthLimit is the limit of bandwidth BandwidthLimit BandwidthLimit // NoRelay is a flag to tell SweetLisa that the server do not want to be relayed NoRelay bool // FailureCount is the number of consecutive failed pings FailureCount int // LastSeen is the time of last succeed ping LastSeen time.Time // SyncNextSeen is a flag indicates the server should be sync next seen SyncNextSeen bool }
type Ticket ¶
type Ticket struct { Ticket string ChatIdentifier string Type TicketType ExpireAt time.Time }
type TicketType ¶
type TicketType int
const ( TicketTypeUser TicketType = iota TicketTypeServer TicketTypeRelay TicketTypeINVALID )
func (TicketType) IsValid ¶
func (t TicketType) IsValid() bool
type Verification ¶
type Verification struct { Code string ExpireAt time.Time ChatIdentifier string Progress VerificationProgress }
type VerificationProgress ¶
type VerificationProgress int
Click to show internal directories.
Click to hide internal directories.