xchgr_server

package
v0.0.0-...-eac29d1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2023 License: MIT Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONCE_SIZE           = 16
	NONCE_COMPLEXITY_POS = 4
)
View Source
const (
	NONCE_COUNT       = 1024 * 1024
	INPUT_BUFFER_SIZE = 1024 * 1024
	STORING_TIMEOUT   = 60 * time.Second
)
View Source
const AddressBytesSize = 30
View Source
const AddressSize = int((AddressBytesSize * 8) / 5)
View Source
const (
	VERSION = int(24)
)

Variables

This section is empty.

Functions

func CheckHash

func CheckHash(hash []byte, complexity byte) bool

func CurrentExePath

func CurrentExePath() string

func NewHost

func NewHost(address string) *host

func NewRange

func NewRange(prefix string) *rng

func RSAPublicKeyFromDer

func RSAPublicKeyFromDer(publicKeyDer []byte) (publicKey *rsa.PublicKey, err error)

func SplitRequest

func SplitRequest(path string) []string

Types

type AddressStorage

type AddressStorage struct {
	TouchDT time.Time
	// contains filtered or unexported fields
}

func NewAddressStorage

func NewAddressStorage() *AddressStorage

func (*AddressStorage) Clear

func (c *AddressStorage) Clear()

func (*AddressStorage) GetBillingInfo

func (c *AddressStorage) GetBillingInfo() BillingInfo

func (*AddressStorage) GetMessage

func (c *AddressStorage) GetMessage(afterId uint64, maxSize uint64) (data []byte, lastId uint64, count int)

func (*AddressStorage) MessagesCount

func (c *AddressStorage) MessagesCount() (count int)

func (*AddressStorage) Put

func (c *AddressStorage) Put(id uint64, frame []byte) error

type BillingInfo

type BillingInfo struct {
	Counter uint32 `json:"counter"`
	Limit   uint32 `json:"limit"`
}

type Contract01

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

func NewContract01

func NewContract01() *Contract01

func (*Contract01) CounterError

func (c *Contract01) CounterError() int

func (*Contract01) CounterSuccess

func (c *Contract01) CounterSuccess() int

func (*Contract01) IsPremium

func (c *Contract01) IsPremium(xchgAddress string) bool

func (*Contract01) Records

func (c *Contract01) Records() []api.ShopRecord

func (*Contract01) RecordsCount

func (c *Contract01) RecordsCount() int

func (*Contract01) Start

func (c *Contract01) Start() error

func (*Contract01) Stop

func (c *Contract01) Stop()

type HttpServer

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

func NewHttpServer

func NewHttpServer() *HttpServer

func (*HttpServer) Start

func (c *HttpServer) Start(server *Router, port int)

func (*HttpServer) Stop

func (c *HttpServer) Stop() error

type Message

type Message struct {
	TouchDT time.Time
	// contains filtered or unexported fields
}

func NewMessage

func NewMessage(id uint64, data []byte) *Message

type Network

type Network struct {
	Name     string  `json:"name"`
	Ranges   []*rng  `json:"ranges"`
	Gateways []*host `json:"gateways"`
	// contains filtered or unexported fields
}

func NewNetwork

func NewNetwork() *Network

func NewNetworkDefault

func NewNetworkDefault() *Network

func NewNetworkFromBytes

func NewNetworkFromBytes(rawContent []byte) (*Network, error)

func NewNetworkFromFile

func NewNetworkFromFile(fileName string) (*Network, error)

func NewNetworkFromFileOrCreate

func NewNetworkFromFileOrCreate(fileName string) (network *Network)

func NewNetworkFromInternet

func NewNetworkFromInternet() *Network

func (*Network) AddHostToRange

func (c *Network) AddHostToRange(prefix string, address string)

func (*Network) GetLocalIPs

func (c *Network) GetLocalIPs() (result []string)

func (*Network) GetLocalPrefixes

func (c *Network) GetLocalPrefixes() []string

func (*Network) GetNodesAddressesByAddress

func (c *Network) GetNodesAddressesByAddress(address string) []string

func (*Network) ReloadFromInternet

func (c *Network) ReloadFromInternet()

func (*Network) SaveToFile

func (c *Network) SaveToFile(fileName string) error

func (*Network) String

func (c *Network) String() string

type Nonces

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

func NewNonces

func NewNonces(size int) *Nonces

func (*Nonces) Check

func (c *Nonces) Check(nonce []byte) bool

func (*Nonces) Next

func (c *Nonces) Next() [NONCE_SIZE]byte

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) DebugString

func (c *Router) DebugString() (result []byte)

func (*Router) DeclareHttpRequestB

func (c *Router) DeclareHttpRequestB()

func (*Router) DeclareHttpRequestD

func (c *Router) DeclareHttpRequestD()

func (*Router) DeclareHttpRequestF

func (c *Router) DeclareHttpRequestF()

func (*Router) DeclareHttpRequestN

func (c *Router) DeclareHttpRequestN()

func (*Router) DeclareHttpRequestNS

func (c *Router) DeclareHttpRequestNS()

func (*Router) DeclareHttpRequestR

func (c *Router) DeclareHttpRequestR()

func (*Router) DeclareHttpRequestS

func (c *Router) DeclareHttpRequestS()

func (*Router) DeclareHttpRequestW

func (c *Router) DeclareHttpRequestW()

func (*Router) GetBillingInfo

func (c *Router) GetBillingInfo(addr string) (BillingInfo, error)

func (*Router) GetMessages

func (c *Router) GetMessages(frame []byte) (response []byte, count int, err error)

Get message request

func (*Router) Put

func (c *Router) Put(frame []byte) error

func (*Router) Start

func (c *Router) Start() error

func (*Router) StatString

func (c *Router) StatString() (result []byte)

func (*Router) Stop

func (c *Router) Stop() error

type RouterSpeedStatistics

type RouterSpeedStatistics struct {
	SpeedHttpRequests   int `json:"http_requests"`
	SpeedHttpRequestsR  int `json:"http_requests_r"`
	SpeedHttpRequestsW  int `json:"http_requests_w"`
	SpeedHttpRequestsN  int `json:"http_requests_n"`
	SpeedHttpRequestsNS int `json:"http_requests_ns"`
	SpeedHttpRequestsD  int `json:"http_requests_d"`
	SpeedHttpRequestsF  int `json:"http_requests_f"`

	SpeedFramesIn  int `json:"frames_in"`
	SpeedFramesOut int `json:"frames_out"`
	SpeedBytesIn   int `json:"bytes_in"`
	SpeedBytesOut  int `json:"bytes_out"`

	SpeedBytesKIn  int `json:"kilobytes_in"`
	SpeedBytesKOut int `json:"kilobytes_out"`

	SpeedBytesMIn  int `json:"megabytes_in"`
	SpeedBytesMOut int `json:"megabytes_out"`

	Contract01CounterSuccess int `json:"contract01_success"`
	Contract01CounterError   int `json:"contract01_error"`
	Contract01CounterRecords int `json:"contract01_records"`

	Version int `json:"version"`
}

type RouterStatistics

type RouterStatistics struct {
	FramesIn  int `json:"frames_in"`
	FramesOut int `json:"frames_out"`
	BytesIn   int `json:"bytes_in"`
	BytesOut  int `json:"bytes_out"`

	HttpRequests   int `json:"http_requests"`
	HttpRequestsR  int `json:"http_requests_r"`
	HttpRequestsW  int `json:"http_requests_w"`
	HttpRequestsN  int `json:"http_requests_n"`
	HttpRequestsB  int `json:"http_requests_b"`
	HttpRequestsNS int `json:"http_requests_ns"`
	HttpRequestsD  int `json:"http_requests_d"`
	HttpRequestsS  int `json:"http_requests_s"`
	HttpRequestsF  int `json:"http_requests_f"`

	Contract01CounterSuccess int `json:"contract01_success"`
	Contract01CounterError   int `json:"contract01_error"`
	Contract01CounterRecords int `json:"contract01_records"`
}

type System

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

func NewSystem

func NewSystem(port int) *System

func (*System) Start

func (c *System) Start()

func (*System) Stop

func (c *System) Stop()

type Udr

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

func NewUdr

func NewUdr() *Udr

func (*Udr) GetIPByXchgAddress

func (c *Udr) GetIPByXchgAddress(xchgAddress string) string

func (*Udr) Start

func (c *Udr) Start()

func (*Udr) State

func (c *Udr) State() string

func (*Udr) Stop

func (c *Udr) Stop()

type UdrRecord

type UdrRecord struct {
	XchgAddress string
	IpPoint     string
}

type UdrState

type UdrState struct {
	Items []UdrRecord
}

Jump to

Keyboard shortcuts

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