utils

package
v0.0.0-...-630efa1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2016 License: BSD-3-Clause, MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckError

func CheckError(err error)

CheckError is a helper function for panicing on errors which we need to handle but should be very rare e.g. failures deserializing a protobuf object that should only happen if there was a bug in the underlying library.

func GetTorHostname

func GetTorHostname(publicKeyBytes []byte) string

GetTorHostname takes a []byte contained a DER-encoded RSA public key and returns the first 16 bytes of the base32 encoded sha1 hash of the key. This is the onion hostname of the tor service represented by the public key.

func RecoverFromError

func RecoverFromError()

RecoverFromError doesn't really recover from anything....see comment below

Types

type NetworkResolver

type NetworkResolver struct {
}

NetworkResolver allows a client to resolve various hostnames to connections The supported types are onions address are:

  • ricochet:jlq67qzo6s4yp3sp
  • jlq67qzo6s4yp3sp
  • 127.0.0.1:55555|jlq67qzo6s4yp3sp - Localhost Connection

func (*NetworkResolver) Resolve

func (nr *NetworkResolver) Resolve(hostname string) (net.Conn, string, error)

Resolve takes a hostname and returns a net.Conn to the derived endpoint

type RicochetData

type RicochetData struct {
	Channel int32
	Data    []byte
}

RicochetData is a structure containing the raw data and the channel it the message originated on.

func (RicochetData) Equals

func (rd RicochetData) Equals(other RicochetData) bool

Equals compares a RicochetData object to another and returns true if contain the same data.

type RicochetNetwork

type RicochetNetwork struct {
}

RicochetNetwork is a concrete implementation of the RicochetNetworkInterface

func (*RicochetNetwork) RecvRicochetPacket

func (rn *RicochetNetwork) RecvRicochetPacket(reader io.Reader) (RicochetData, error)

RecvRicochetPacket returns the next packet from reader as a RicochetData structure, or an error.

func (*RicochetNetwork) SendRicochetPacket

func (rn *RicochetNetwork) SendRicochetPacket(dst io.Writer, channel int32, data []byte) error

SendRicochetPacket places the data into a structure needed for the client to decode the packet and writes the packet to the network.

type RicochetNetworkInterface

type RicochetNetworkInterface interface {
	SendRicochetPacket(dst io.Writer, channel int32, data []byte) error
	RecvRicochetPacket(reader io.Reader) (RicochetData, error)
}

RicochetNetworkInterface abstract operations that interact with ricochet's packet layer.

Jump to

Keyboard shortcuts

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