server

package
v0.174.8 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: MPL-2.0 Imports: 44 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LinkPreviewThumbnailPath       = "/link-preview/thumbnail"
	StatusLinkPreviewThumbnailPath = "/status-link-preview/thumbnail"
)

Variables

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

Functions

func FindReachableAddressesForPairingClient added in v0.164.0

func FindReachableAddressesForPairingClient(serverIps []net.IP) ([]net.IP, error)

FindReachableAddressesForPairingClient is a high-level func that returns a reachable server's address to be used by local pairing client.

func GenerateTLSCert added in v0.154.4

func GenerateTLSCert(notBefore, notAfter time.Time, IPAddresses []net.IP, DNSNames []string) (*tls.Certificate, []byte, error)

func GenerateX509Cert added in v0.97.4

func GenerateX509Cert(sn *big.Int, from, to time.Time, IPAddresses []net.IP, DNSNames []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 GetLocalAddressesForPairingServer added in v0.164.0

func GetLocalAddressesForPairingServer() ([]net.IP, error)

GetLocalAddressesForPairingServer is a high-level func that returns a list of addresses to be used by local pairing server.

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 PublicMediaTLSCert added in v0.154.4

func PublicMediaTLSCert() (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 ImageParams added in v0.163.9

type ImageParams struct {
	KeyUID                string
	PublicKey             string
	ImageName             string
	ImagePath             string
	FullName              string
	InitialsLength        int
	FontFile              string
	FontSize              float64
	Color                 color.Color
	BgSize                int
	BgColor               color.Color
	UppercaseRatio        float64
	Theme                 ring.Theme
	Ring                  bool
	RingWidth             float64
	IndicatorSize         float64
	IndicatorBorder       float64
	IndicatorCenterToEdge float64
	IndicatorColor        color.Color

	AuthorID     string
	URL          string
	MessageID    string
	AttachmentID string
	ImageID      string

	Hash     string
	Download bool
}

func ParseImageParams added in v0.163.9

func ParseImageParams(logger *zap.Logger, params url.Values) ImageParams

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, walletDB *sql.DB) (*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) MakeCommunityTokenImagesURL added in v0.171.39

func (s *MediaServer) MakeCommunityTokenImagesURL(communityID string, chainID uint64, symbol string) string

func (*MediaServer) MakeContactImageURL added in v0.156.1

func (s *MediaServer) MakeContactImageURL(publicKey string, imageType 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) 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) MakeLinkPreviewThumbnailURL added in v0.151.12

func (s *MediaServer) MakeLinkPreviewThumbnailURL(msgID string, previewURL 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) MakeStatusLinkPreviewThumbnailURL added in v0.170.0

func (s *MediaServer) MakeStatusLinkPreviewThumbnailURL(msgID string, previewURL string, imageID common.MediaServerImageID) string

func (*MediaServer) MakeStickerURL added in v0.102.2

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

func (*MediaServer) MakeWalletCollectibleImagesURL added in v0.171.35

func (s *MediaServer) MakeWalletCollectibleImagesURL(collectibleID thirdparty.CollectibleUniqueID) string

func (*MediaServer) MakeWalletCollectionImagesURL added in v0.171.35

func (s *MediaServer) MakeWalletCollectionImagesURL(contractID thirdparty.ContractID) string

func (*MediaServer) MakeWalletCommunityImagesURL added in v0.171.35

func (s *MediaServer) MakeWalletCommunityImagesURL(communityID 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