Documentation ¶
Index ¶
- Constants
- Variables
- func FindReachableAddressesForPairingClient(serverIps []net.IP) ([]net.IP, error)
- func GenerateTLSCert(notBefore, notAfter time.Time, IPAddresses []net.IP, DNSNames []string) (*tls.Certificate, []byte, error)
- func GenerateX509Cert(sn *big.Int, from, to time.Time, IPAddresses []net.IP, DNSNames []string) *x509.Certificate
- func GenerateX509PEMs(cert *x509.Certificate, key *ecdsa.PrivateKey) (certPem, keyPem []byte, err error)
- func GetDeviceName() (string, error)
- func GetLocalAddressesForPairingServer() ([]net.IP, error)
- func GetLogoImage(multiaccountsDB *multiaccounts.Database, keyUID string, imageName string) ([]byte, error)
- func GetOutboundIP() (net.IP, error)
- func GetPadding(imgBytes []byte) int
- func PublicMediaTLSCert() (string, error)
- func RemoveSuffix(input, suffix string) string
- func ToECDSA(d []byte) *ecdsa.PrivateKey
- func ToLogoImageFromBytes(imageBytes []byte, padding int) ([]byte, error)
- type HandlerPatternMap
- type ImageParams
- type MediaServer
- func (p *MediaServer) GetPort() int
- func (s *MediaServer) MakeAudioURL(id string) string
- func (s *MediaServer) MakeContactImageURL(publicKey string, imageType string) string
- func (s *MediaServer) MakeDiscordAttachmentURL(messageID string, id string) string
- func (s *MediaServer) MakeDiscordAuthorAvatarURL(authorID string) string
- func (s *MediaServer) MakeImageServerURL() string
- func (s *MediaServer) MakeImageURL(id string) string
- func (s *MediaServer) MakeLinkPreviewThumbnailURL(msgID string, previewURL string) string
- func (s *MediaServer) MakeQRURL(qurul string, allowProfileImage string, level string, size string, ...) string
- func (s *MediaServer) MakeStickerURL(stickerHash string) string
- func (p *MediaServer) MustGetPort() int
- func (p *MediaServer) ResetPort()
- func (p *MediaServer) SetPort(port int) error
- func (t MediaServer) SetTimeout(milliseconds uint)
- func (t MediaServer) StartTimeout(terminate func())
- func (t MediaServer) StopTimeout()
- type QRConfig
- type Server
- func (s *Server) AddHandlers(handlers HandlerPatternMap)
- func (s *Server) GetCert() *tls.Certificate
- func (s *Server) GetHostname() string
- func (s *Server) GetLogger() *zap.Logger
- func (p *Server) GetPort() int
- func (s *Server) IsRunning() bool
- func (s *Server) MakeBaseURL() *url.URL
- func (p *Server) MustGetPort() int
- func (p *Server) ResetPort()
- func (s *Server) SetHandlers(handlers HandlerPatternMap)
- func (p *Server) SetPort(port int) error
- func (t Server) SetTimeout(milliseconds uint)
- func (s *Server) Start() error
- func (t Server) StartTimeout(terminate func())
- func (s *Server) Stop() error
- func (t Server) StopTimeout()
- func (s *Server) ToBackground()
- func (s *Server) ToForeground()
- type WriterCloserByteBuffer
Constants ¶
const (
LinkPreviewThumbnailPath = "/link-preview/thumbnail"
)
Variables ¶
var ( LocalHostIP = net.IP{127, 0, 0, 1} Localhost = "Localhost" )
Functions ¶
func FindReachableAddressesForPairingClient ¶ added in v0.164.0
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 GenerateX509Cert ¶ added in v0.97.4
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 GetLocalAddressesForPairingServer ¶ added in v0.164.0
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 GetOutboundIP ¶ added in v0.102.2
func GetPadding ¶ added in v0.135.0
func PublicMediaTLSCert ¶ added in v0.154.4
func RemoveSuffix ¶ added in v0.115.4
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
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 IndicatorColor color.Color AuthorID string URL string MessageID string AttachmentID 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) (*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) 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) 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
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 Server ¶
type Server struct {
// contains filtered or unexported fields
}
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 (*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) MakeBaseURL ¶ added in v0.102.2
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
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) 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) 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
func NewWriterCloserByteBuffer ¶ added in v0.129.3
func NewWriterCloserByteBuffer() *WriterCloserByteBuffer
func (WriterCloserByteBuffer) Close ¶ added in v0.129.3
func (wc WriterCloserByteBuffer) Close() error
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package servertest provides utilities for server testing.
|
Package servertest provides utilities for server testing. |