server

package
v0.141.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: MPL-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultIP = net.IP{127, 0, 0, 1}
	Localhost = "Localhost"
)

Functions

func GenerateX509Cert added in v0.97.4

func GenerateX509Cert(sn *big.Int, from, to time.Time, hostname string) *x509.Certificate

func GenerateX509PEMs added in v0.97.4

func GenerateX509PEMs(cert *x509.Certificate, key *ecdsa.PrivateKey) (certPem, keyPem []byte, err error)

func GetDeviceName added in v0.115.4

func GetDeviceName() (string, error)

func GetLogoImage added in v0.135.0

func GetLogoImage(multiaccountsDB *multiaccounts.Database, keyUID string, imageName string) ([]byte, error)

func GetOutboundIP added in v0.102.2

func GetOutboundIP() (net.IP, error)

func GetPadding added in v0.135.0

func GetPadding(imgBytes []byte) int

func PublicTLSCert

func PublicTLSCert() (string, error)

func RemoveSuffix added in v0.115.4

func RemoveSuffix(input, suffix string) string

func ToECDSA added in v0.102.2

func ToECDSA(d []byte) *ecdsa.PrivateKey

ToECDSA takes a []byte of D and uses it to create an ecdsa.PublicKey on the elliptic.P256 curve this function is basically a P256 curve version of eth-node/crypto.ToECDSA without all the nice validation

func ToLogoImageFromBytes added in v0.135.0

func ToLogoImageFromBytes(imageBytes []byte, padding int) ([]byte, error)

Types

type HandlerPatternMap added in v0.102.2

type HandlerPatternMap map[string]http.HandlerFunc

type MediaServer added in v0.102.2

type MediaServer struct {
	Server
	// contains filtered or unexported fields
}

func NewMediaServer added in v0.102.2

func NewMediaServer(db *sql.DB, downloader *ipfs.Downloader, multiaccountsDB *multiaccounts.Database) (*MediaServer, error)

NewMediaServer returns a *MediaServer

func (*MediaServer) GetPort added in v0.113.0

func (p *MediaServer) GetPort() int

GetPort gets the current value of portManager.port without any concern for the state of its value and therefore does not wait if portManager.port is 0

func (*MediaServer) MakeAudioURL added in v0.102.2

func (s *MediaServer) MakeAudioURL(id string) string

func (*MediaServer) MakeDiscordAttachmentURL added in v0.111.5

func (s *MediaServer) MakeDiscordAttachmentURL(messageID string, id string) string

func (*MediaServer) MakeDiscordAuthorAvatarURL added in v0.111.5

func (s *MediaServer) MakeDiscordAuthorAvatarURL(authorID string) string

func (*MediaServer) MakeIdenticonURL added in v0.102.2

func (s *MediaServer) MakeIdenticonURL(from string) string

func (*MediaServer) MakeImageServerURL added in v0.102.2

func (s *MediaServer) MakeImageServerURL() string

func (*MediaServer) MakeImageURL added in v0.102.2

func (s *MediaServer) MakeImageURL(id string) string

func (*MediaServer) MakeQRURL added in v0.129.3

func (s *MediaServer) MakeQRURL(qurul string,
	allowProfileImage string,
	level string,
	size string,
	keyUID string,
	imageName string) string

func (*MediaServer) MakeStickerURL added in v0.102.2

func (s *MediaServer) MakeStickerURL(stickerHash string) string

func (*MediaServer) MustGetPort added in v0.113.0

func (p *MediaServer) MustGetPort() int

MustGetPort only returns portManager.port if portManager.port is not 0.

func (*MediaServer) ResetPort added in v0.113.0

func (p *MediaServer) ResetPort()

ResetPort resets portManger.port to 0

func (*MediaServer) SetPort added in v0.113.0

func (p *MediaServer) SetPort(port int) error

SetPort sets portManger.port field to the given port value next triggers any given portManger.afterPortChanged function

func (MediaServer) SetTimeout added in v0.131.7

func (t MediaServer) SetTimeout(milliseconds uint)

SetTimeout sets the value of the timeoutManager.timeout

func (MediaServer) StartTimeout added in v0.131.7

func (t MediaServer) StartTimeout(terminate func())

StartTimeout starts a timeout operation based on the set timeoutManager.timeout value the given terminate func() will be executed once the timeout duration has passed

func (MediaServer) StopTimeout added in v0.131.7

func (t MediaServer) StopTimeout()

StopTimeout terminates a timeout operation and exits gracefully

type QRConfig added in v0.135.0

type QRConfig struct {
	DecodedQRURL    string
	CorrectionLevel qrcode.EncodeOption
	KeyUID          string
	ImageName       string
	Size            int
	Params          url.Values
}

func NewQRConfig added in v0.135.0

func NewQRConfig(params url.Values, logger *zap.Logger) (*QRConfig, error)

type Server

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

func NewServer

func NewServer(cert *tls.Certificate, hostname string, afterPortChanged func(int), logger *zap.Logger) Server

func (*Server) AddHandlers added in v0.106.3

func (s *Server) AddHandlers(handlers HandlerPatternMap)

func (*Server) GetCert added in v0.118.0

func (s *Server) GetCert() *tls.Certificate

func (*Server) GetHostname added in v0.118.0

func (s *Server) GetHostname() string

func (*Server) GetLogger added in v0.118.0

func (s *Server) GetLogger() *zap.Logger

func (*Server) GetPort added in v0.113.0

func (p *Server) GetPort() int

GetPort gets the current value of portManager.port without any concern for the state of its value and therefore does not wait if portManager.port is 0

func (*Server) IsRunning added in v0.131.7

func (s *Server) IsRunning() bool

func (*Server) MakeBaseURL added in v0.102.2

func (s *Server) MakeBaseURL() *url.URL

func (*Server) MustGetPort added in v0.113.0

func (p *Server) MustGetPort() int

MustGetPort only returns portManager.port if portManager.port is not 0.

func (*Server) ResetPort added in v0.113.0

func (p *Server) ResetPort()

ResetPort resets portManger.port to 0

func (*Server) SetHandlers added in v0.102.2

func (s *Server) SetHandlers(handlers HandlerPatternMap)

func (*Server) SetPort added in v0.113.0

func (p *Server) SetPort(port int) error

SetPort sets portManger.port field to the given port value next triggers any given portManger.afterPortChanged function

func (Server) SetTimeout added in v0.131.7

func (t Server) SetTimeout(milliseconds uint)

SetTimeout sets the value of the timeoutManager.timeout

func (*Server) Start

func (s *Server) Start() error

func (Server) StartTimeout added in v0.131.7

func (t Server) StartTimeout(terminate func())

StartTimeout starts a timeout operation based on the set timeoutManager.timeout value the given terminate func() will be executed once the timeout duration has passed

func (*Server) Stop

func (s *Server) Stop() error

func (Server) StopTimeout added in v0.131.7

func (t Server) StopTimeout()

StopTimeout terminates a timeout operation and exits gracefully

func (*Server) ToBackground

func (s *Server) ToBackground()

func (*Server) ToForeground

func (s *Server) ToForeground()

type WriterCloserByteBuffer added in v0.129.3

type WriterCloserByteBuffer struct {
	*bytes.Buffer
}

func NewWriterCloserByteBuffer added in v0.129.3

func NewWriterCloserByteBuffer() *WriterCloserByteBuffer

func (WriterCloserByteBuffer) Close added in v0.129.3

func (wc WriterCloserByteBuffer) Close() error

Directories

Path Synopsis
Package servertest provides utilities for server testing.
Package servertest provides utilities for server testing.

Jump to

Keyboard shortcuts

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