Documentation ¶
Index ¶
- func GenerateCertFromKey(pk *ecdsa.PrivateKey, from time.Time, hostname string) (tls.Certificate, []byte, error)
- func GenerateX509Cert(sn *big.Int, from, to time.Time, hostname string) *x509.Certificate
- func GenerateX509PEMs(cert *x509.Certificate, key *ecdsa.PrivateKey) (certPem, keyPem []byte, err error)
- func GetOutboundIP() (net.IP, error)
- func PublicTLSCert() (string, error)
- func ToECDSA(d []byte) *ecdsa.PrivateKey
- type Config
- type ConnectionParamVersion
- type ConnectionParams
- type HandlerPatternMap
- type MediaServer
- type Mode
- type PairingServer
- type Server
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 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 PublicTLSCert ¶
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 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
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
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) MakeBaseURL ¶ added in v0.102.2
func (*Server) SetHandlers ¶ added in v0.102.2
func (s *Server) SetHandlers(handlers HandlerPatternMap)
func (*Server) ToBackground ¶
func (s *Server) ToBackground()
func (*Server) ToForeground ¶
func (s *Server) ToForeground()