server

package
v0.102.7 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: MPL-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateCertFromKey added in v0.102.2

func GenerateCertFromKey(pk *ecdsa.PrivateKey, from time.Time, hostname string) (tls.Certificate, []byte, error)

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 GetOutboundIP added in v0.102.2

func GetOutboundIP() (net.IP, error)

func PublicTLSCert

func PublicTLSCert() (string, error)

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 Config added in v0.102.2

type Config struct {
	PK       *ecdsa.PrivateKey
	Cert     *tls.Certificate
	Hostname string
	Mode     Mode
}

type ConnectionParamVersion added in v0.102.2

type ConnectionParamVersion int
const (
	Version1 ConnectionParamVersion = iota + 1
)

type ConnectionParams added in v0.102.2

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

func NewConnectionParams added in v0.102.2

func NewConnectionParams(netIP net.IP, port int, privateKey *ecdsa.PrivateKey, notBefore time.Time, mode Mode) *ConnectionParams

func (*ConnectionParams) FromString added in v0.102.2

func (cp *ConnectionParams) FromString(s string) error

FromString parses a connection params string required for to securely connect to another Status device. This function parses a connection string generated by ToString

func (*ConnectionParams) Generate added in v0.102.2

func (cp *ConnectionParams) Generate() (*url.URL, []byte, error)

Generate returns a *url.URL and encoded pem.Block generated from ConnectionParams set fields

func (*ConnectionParams) ToString added in v0.102.2

func (cp *ConnectionParams) ToString() (string, error)

ToString generates a string required for generating a secure connection to another Status device.

The returned string will look like below:

  • "2:4FHRnp:H6G:6jpbvo2ucrtrnpXXF4DQYuysh697isH9ppd2aT8uSRDh:eQUriVtGtkWhPJFeLZjF:2"

Format bytes encoded into a base58 string, delimited by ":"

  • version
  • net.IP
  • port
  • ecdsa.PrivateKey D field
  • asn1.Marshal time.Time
  • server mode

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) (*MediaServer, error)

NewMediaServer returns a *MediaServer

func (*MediaServer) MakeAudioURL added in v0.102.2

func (s *MediaServer) MakeAudioURL(id 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) MakeStickerURL added in v0.102.2

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

type Mode added in v0.102.2

type Mode int
const (
	Receiving Mode = iota + 1
	Sending
)

type PairingClient added in v0.102.5

type PairingClient struct {
	*http.Client
	// contains filtered or unexported fields
}

func NewPairingClient added in v0.102.5

func NewPairingClient(c *ConnectionParams) (*PairingClient, error)

func (*PairingClient) MountPayload added in v0.102.5

func (c *PairingClient) MountPayload(data []byte) error

func (*PairingClient) PairAccount added in v0.102.5

func (c *PairingClient) PairAccount() error

type PairingServer added in v0.102.2

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

func NewPairingServer added in v0.102.2

func NewPairingServer(config *Config) (*PairingServer, error)

NewPairingServer returns a *NewPairingServer init from the given *Config

func (*PairingServer) MakeConnectionParams added in v0.102.2

func (s *PairingServer) MakeConnectionParams() (*ConnectionParams, error)

MakeConnectionParams generates a *ConnectionParams based on the Server's current state

func (*PairingServer) MountPayload added in v0.102.5

func (s *PairingServer) MountPayload(data []byte) error

func (*PairingServer) StartPairing added in v0.102.5

func (s *PairingServer) StartPairing() error

type Payload added in v0.102.5

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

type PayloadManager added in v0.102.5

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

func NewPayloadManager added in v0.102.5

func NewPayloadManager(pk *ecdsa.PrivateKey) (*PayloadManager, error)

func (*PayloadManager) Mount added in v0.102.5

func (pm *PayloadManager) Mount(data []byte) error

func (*PayloadManager) Receive added in v0.102.5

func (pm *PayloadManager) Receive(data []byte) error

func (*PayloadManager) Received added in v0.102.5

func (pm *PayloadManager) Received() []byte

func (*PayloadManager) ResetPayload added in v0.102.5

func (pm *PayloadManager) ResetPayload()

func (*PayloadManager) ToSend added in v0.102.5

func (pm *PayloadManager) ToSend() []byte

type Server

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

func NewServer

func NewServer(cert *tls.Certificate, hostname string) Server

func (*Server) MakeBaseURL added in v0.102.2

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

func (*Server) SetHandlers added in v0.102.2

func (s *Server) SetHandlers(handlers HandlerPatternMap)

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() error

func (*Server) ToBackground

func (s *Server) ToBackground()

func (*Server) ToForeground

func (s *Server) ToForeground()

Jump to

Keyboard shortcuts

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