Documentation ¶
Overview ¶
Package repproto implements the repbin protocol wrappers.
Index ¶
- Constants
- Variables
- type Proto
- func (proto *Proto) Auth(server string, privKey []byte) (string, error)
- func (proto *Proto) Get(messageID []byte) (string, []byte, error)
- func (proto *Proto) GetGlobalIndex(server, auth string, start, count int) (messages []*structs.MessageStruct, more bool, err error)
- func (proto *Proto) GetSpecific(server string, messageID []byte) ([]byte, error)
- func (proto *Proto) GetSpecificAuth(server, auth string, messageID []byte) ([]byte, error)
- func (proto *Proto) ID(server string) (*ServerInfo, error)
- func (proto *Proto) List(pubKey, privKey []byte, start, count int) (server string, messages []*structs.MessageStruct, more bool, err error)
- func (proto *Proto) ListSpecific(server string, pubKey, privKey []byte, start, count int) (messages []*structs.MessageStruct, more bool, err error)
- func (proto *Proto) Notify(server, auth string) error
- func (proto *Proto) Post(messageID []byte, message []byte) (string, error)
- func (proto *Proto) PostSpecific(server string, message []byte) error
- type ServerInfo
Constants ¶
View Source
const Version = "0.0.2 very alpha"
Version of this release
Variables ¶
View Source
var ( // ErrNoServers is returned if no servers are known ErrNoServers = errors.New("rep: No servers") // ErrNoResponse is returned if no response could be gotten ErrNoResponse = errors.New("rep: No response") // ErrBadProto is returned if the protocol is not adhered to ErrBadProto = errors.New("rep: Bad proto") // ErrNoMoreServers is returned if no more servers are available ErrNoMoreServers = errors.New("rep: Servers exhausted") // ErrPrivKey is returned if authentication is required but the private key was not given ErrPrivKey = errors.New("rep: Private key required but missing") )
Functions ¶
This section is empty.
Types ¶
type Proto ¶
type Proto struct { SocksServer string // the socks server Servers []string // Repbin servers // ServerSelector replaces server selection. first string is messageID, remaining are available servers. // ServerSelector MUST return ErrNoMoreServers when servers are exhausted or an infinite loop will result ServerSelector func([]byte, ...string) (string, error) // SelectorReset resets server selection SelectorReset func() // contains filtered or unexported fields }
Proto implements the protocol wrappers
func (*Proto) GetGlobalIndex ¶
func (proto *Proto) GetGlobalIndex(server, auth string, start, count int) (messages []*structs.MessageStruct, more bool, err error)
GetGlobalIndex returns the global index of a server
func (*Proto) GetSpecific ¶
GetSpecific fetches a message from a specific server
func (*Proto) GetSpecificAuth ¶
GetSpecificAuth fetches a message from a specific server using authentication
func (*Proto) ID ¶
func (proto *Proto) ID(server string) (*ServerInfo, error)
ID returns the ID of a specific server
func (*Proto) List ¶
func (proto *Proto) List(pubKey, privKey []byte, start, count int) (server string, messages []*structs.MessageStruct, more bool, err error)
List messages for pubKey
func (*Proto) ListSpecific ¶
func (proto *Proto) ListSpecific(server string, pubKey, privKey []byte, start, count int) (messages []*structs.MessageStruct, more bool, err error)
ListSpecific lists the messages for pubKey from a specific server
type ServerInfo ¶
type ServerInfo struct { Time int64 AuthPubKey string AuthChallenge string MaxPostSize int64 // Maximum post size MinPostSize int // Minimum post size MinHashCashBits byte // Minimum hashcash bits required Peers []string // Peers of the server, if any }
ServerInfo public server info
Click to show internal directories.
Click to hide internal directories.