Documentation ¶
Overview ¶
Package client implements client functionality for the Mute mix system.
Index ¶
- Variables
- func AccountStat(privkey *[ed25519.PrivateKeySize]byte, server string, cacert []byte) (loadTime int64, err error)
- func DeleteAccount(privkey *[ed25519.PrivateKeySize]byte, server string, cacert []byte) (err error)
- func FetchMessage(privkey *[ed25519.PrivateKeySize]byte, messageID []byte, server string, ...) ([]byte, error)
- func GetMixKeys(mixaddress string, cacert []byte) (*mixaddr.AddressStatement, error)
- func HTTPSGet(getURL string, cacert []byte) ([]byte, error)
- func HTTPSPost(postValues url.Values, postURL string, cacert []byte) ([]byte, error)
- func PayAccount(privkey *[ed25519.PrivateKeySize]byte, paytoken []byte, serverKnown string, ...) (server string, err error)
- func ReadMail(message []byte) (body []byte, err error)
- func RevokeMessage(revokeID []byte, mixaddress string, cacert []byte) (bool, error)
- func WriteMail(sender, receiver string, body []byte) (mail []byte)
- type MessageInput
- type MessageMarshalled
- type MessageMeta
- type MessageOutput
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMaxSize is returned if a message is too long. ErrMaxSize = errors.New("mixclient: message too long") // ErrNoHost is returned if no host could be selected. ErrNoHost = errors.New("mixclient: no RPC host found") // ErrNIL is returned when operating on nil value because of coding errors. ErrNIL = errors.New("mixclient: nil value") // ErrAlreadySent is returned if trying to resend a message. Coding error! ErrAlreadySent = errors.New("mixclient: already sent") // ErrProto is returned if there was a protocol error in RPC. ErrProto = errors.New("mixclient: bad RPC protocol") // ErrNoMatch is returned if no account was found. ErrNoMatch = errors.New("mixclient: no match") )
var DefaultAccountServer = "rr.accounts.mute.one"
DefaultAccountServer is the URL of the account server round-robin.
var DefaultClientFactory = jsonclient.New
DefaultClientFactory is the default factory for new clients.
var DefaultSender = "client@mute.one"
DefaultSender is the sender address for client messages.
var DefaultTimeOut = 30
DefaultTimeOut is the timeout for RPC calls.
var GetMixAddress = getMixAddressReal
GetMixAddress is used to get the address of a mix rpc. It should only be changed for debugging purposes or if the routing is replaced.
var MaxMessageSize = 266240
MaxMessageSize is the maximum size a message may have.
var RPCPort = "2080"
RPCPort is the default port for RPC calls.
Functions ¶
func AccountStat ¶
func AccountStat(privkey *[ed25519.PrivateKeySize]byte, server string, cacert []byte) (loadTime int64, err error)
AccountStat gets the time until which the account of privkey on server expires.
func DeleteAccount ¶
DeleteAccount deletes the account of privkey on server.
func FetchMessage ¶
func FetchMessage(privkey *[ed25519.PrivateKeySize]byte, messageID []byte, server string, cacert []byte) ([]byte, error)
FetchMessage fetches a message from the accountserver.
func GetMixKeys ¶
func GetMixKeys(mixaddress string, cacert []byte) (*mixaddr.AddressStatement, error)
GetMixKeys gets the keys for the mix.
func PayAccount ¶
func PayAccount(privkey *[ed25519.PrivateKeySize]byte, paytoken []byte, serverKnown string, cacert []byte) (server string, err error)
PayAccount makes a pay call to server (or selects a new one) to create or extend an account identified by privkey.
func RevokeMessage ¶
RevokeMessage calls the revokation RPC to revoke a message, if possible.
Types ¶
type MessageInput ¶
type MessageInput struct {
SenderMinDelay, SenderMaxDelay int32 // Mix settings
Token []byte // Payment token
NymAddress []byte // The nym-address of the recipient
Message []byte // The message itself
SMTPPort int // Port on which to do SMTP. Can be empty
SmartHost string // Server to which to send. Can be empty
CACert []byte // CACert for TLS verification on SMTP
}
MessageInput contains everything to describe an outgoing message.
func (MessageInput) Create ¶
func (mi MessageInput) Create() (messageOut *MessageOutput)
Create a message described in messageInput.
type MessageMarshalled ¶
type MessageMarshalled []byte
MessageMarshalled contains a marshalled MessageOutput.
func (MessageMarshalled) Unmarshal ¶
func (mm MessageMarshalled) Unmarshal() *MessageOutput
Unmarshal a MessageMarshalled.
type MessageMeta ¶
type MessageMeta struct { MessageID []byte ReceiveTime, ReceiveTimeNano, ReadTime int64 UserKey [ed25519.PublicKeySize]byte }
MessageMeta contains metadata on a message.
func ListMessages ¶
func ListMessages(privkey *[ed25519.PrivateKeySize]byte, lastMessageTime int64, server string, cacert []byte) (messages []MessageMeta, err error)
ListMessages gets the messages for account identified by privkey.
type MessageOutput ¶
type MessageOutput struct { Message []byte // Nil on success To string // Empty on success From string // Empty on success RevokeID []byte // Set if develivery was attempted SMTPPort int // Port on which to do SMTP. Can be empty SmartHost string // Server to which to send. Can be empty CACert []byte // CACert for TLS verification on SMTP Error error // Non-Nil on error Resend bool // Bool if sending might help }
MessageOutput contains the result of a develivery attempt.
func (*MessageOutput) Deliver ¶
func (mo *MessageOutput) Deliver() (messageOut *MessageOutput, err error)
Deliver a message countained in messageOutput. Can be used like this:
messageOut, err := messageIn.Create().Deliver() for err!=nil && messageOut.Resend { cache := messageOut.Marshal() //...wait/stop/quit/sleep -> restart/wakeup messageOut, err = cache.UnMarshal().Deliver() } //...done
func (*MessageOutput) Marshal ¶
func (mo *MessageOutput) Marshal() MessageMarshalled
Marshal a MessageOutput to a MessageMarshalled.