Documentation ¶
Index ¶
- Constants
- type File
- type Identity
- type Message
- type Server
- func (s *Server) CreateTables()
- func (m *Server) GetAnyMessageWithName(name string, owner string) (*Message, error)
- func (m *Server) GetData(author string, key string) ([]byte, error)
- func (m *Server) GetDataMessageNamed(name string, owner string, receiver string) (*File, error)
- func (m *Server) GetIncomingMessagesSince(since uint64, owner string) ([]*Message, error)
- func (m *Server) GetMessages(since uint64, owner string, context bool) ([]*dap.ResponseMessage, error)
- func (m *Server) GetOutgoingMessageWithName(name string, owner string, receiver string) (*Message, error)
- func (m *Server) GetOutgoingMessagesFor(since uint64, owner string) ([]*Message, error)
- func (m *Server) GetOutgoingPublicMessagesFor(since uint64, owner string, receiver string) ([]*Message, error)
- func (m *Server) GetSentMessages(since uint64, owner string, context bool) ([]*dap.ResponseMessage, error)
- func (m *Server) PublishDataMessage(name string, to []string, author string, message *message.EncryptedMessage, ...) error
- func (m *Server) PublishMessage(name string, to []string, author string, message *message.EncryptedMessage, ...) error
- func (m *Server) Register(user string, keys map[string][]byte) error
- func (m *Server) RetrieveDataForUser(name string, author *identity.Address, forAddr *identity.Address) (*message.EncryptedMessage, io.ReadCloser)
- func (m *Server) RetrieveMessageForUser(name string, author *identity.Address, forAddr *identity.Address) *message.EncryptedMessage
- func (m *Server) RetrieveMessageListForUser(since uint64, author *identity.Address, forAddr *identity.Address) []*message.EncryptedMessage
- func (m *Server) Run(port int) error
- func (m *Server) SaveDataMessage(name string, to []string, from string, message *message.EncryptedMessage, ...) error
- func (m *Server) SaveIncomingMessage(message *message.EncryptedMessage) error
- func (m *Server) SaveMessage(name string, to []string, from string, message *message.EncryptedMessage, ...) error
- func (m *Server) SaveMessageDescription(alert *message.EncryptedMessage)
- func (m *Server) SetData(author string, key string, data []byte) error
- func (m *Server) Unregister(user string, keys map[string][]byte) error
- func (m *Server) UpdateMessage(name string, author string, message *message.EncryptedMessage) error
- func (m *Server) UserForIdentity(id string) (*User, error)
- type Storage
- type User
Constants ¶
const ( TableNameUser = "melange_user" TableNameIdentity = "melange_identity" TableNameMessage = "melange_message" TableNameStorage = "melange_storage" TableNameDataMessage = "melange_data_msg" )
Table Names
const ( PKUser = "Id" PKIdentity = "Id" PKMessage = "Id" PKStorage = "Id" PKDataMessage = "Id" )
Primary Key Names
const ( TypeOutgoingPublic = iota TypeOutgoingPrivate TypeIncoming )
const QueryAnyNamed = "select * from " + TableNameMessage + " o where o.Owner = :owner and o.Name = :name"
const QueryDataMessage = "select * from " + TableNameDataMessage + " o where o.Owner = :owner and o.Name = :name and (o.To like :recv or o.To = '')"
const QueryIdentity = "select u.Id, u.Name, u.Receiving, u.RegisteredOn from " + TableNameUser + " u, " + TableNameIdentity + " i where " + "u.Id = i.Owner and i.Signing = :key"
const QueryIncoming = "select * from " + TableNameMessage + " o where o.To like :owner and o.Received > :time and o.Type = 2"
const QueryOutgoing = "select * from " + TableNameMessage + " o where o.Owner = :owner and (o.Type = 0 or o.Type = 1) and o.Received > :time"
const QueryOutgoingNamed = "select * from " + TableNameMessage + " o where o.Owner = :owner and o.Name = :name and ((o.To like :recv and o.Type = 1) or (o.To = '' and o.Type = 0))"
const QueryOutgoingPublic = "select * from " + TableNameMessage + " o where o.Owner = :owner and (o.To like :recv or o.To = '') and o.Received > :time and o.Type = 0"
const QueryStorage = "select s.Key, s.Value from " + TableNameStorage + " s, " + TableNameUser + " u, " + TableNameIdentity + " i where " +
"s.Key = :key and u.Id = i.Owner and i.Signing = :signing and u.Id = s.Owner"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct { Id int // To / From Information Owner int To string Sender string // Message Information Name string Path string Length int64 Message []byte // Metadata Received int64 }
File represents the AD Data messages.
func (*File) ToDispatch ¶
func (o *File) ToDispatch(retriever string) (*message.EncryptedMessage, error)
Change Outgoing Message into Encrypted Message
type Message ¶
type Message struct { Id int // Recipient Information To string Sender string Owner int // Message Information Name string Data []byte Type int // Metadata Received int64 // contains filtered or unexported fields }
Outgoing Messages
func (*Message) ToDispatch ¶
func (o *Message) ToDispatch(retriever string) (*message.EncryptedMessage, error)
Change Outgoing Message into Encrypted Message
type Server ¶
type Server struct { // Basic Properties Me string KeyFile string Key *identity.Identity // Tracker Properties TrackerURL string Alias string // Database DBConn string DBType string // Import Logging and Such server.BasicServer // contains filtered or unexported fields }
Server exposes a structure that holds all the properties of an AirDisaptch dispatcher.
func (*Server) GetAnyMessageWithName ¶
func (*Server) GetDataMessageNamed ¶
Return Outgoing Message Named
func (*Server) GetIncomingMessagesSince ¶
Return Incoming Messages Since
func (*Server) GetMessages ¶
func (m *Server) GetMessages(since uint64, owner string, context bool) ([]*dap.ResponseMessage, error)
New Name for DAP Handler
func (*Server) GetOutgoingMessageWithName ¶
func (m *Server) GetOutgoingMessageWithName(name string, owner string, receiver string) (*Message, error)
Return Outgoing Message Named
func (*Server) GetOutgoingMessagesFor ¶ added in v0.1.2
func (*Server) GetOutgoingPublicMessagesFor ¶
func (m *Server) GetOutgoingPublicMessagesFor(since uint64, owner string, receiver string) ([]*Message, error)
Return Outgoing Public Messages for a Receiver
func (*Server) GetSentMessages ¶ added in v0.1.2
func (m *Server) GetSentMessages(since uint64, owner string, context bool) ([]*dap.ResponseMessage, error)
get sent messages from server
func (*Server) PublishDataMessage ¶
func (m *Server) PublishDataMessage(name string, to []string, author string, message *message.EncryptedMessage, length uint64, r dap.ReadVerifier) error
func (*Server) PublishMessage ¶
func (*Server) RetrieveDataForUser ¶
func (m *Server) RetrieveDataForUser(name string, author *identity.Address, forAddr *identity.Address) (*message.EncryptedMessage, io.ReadCloser)
func (*Server) RetrieveMessageForUser ¶
func (m *Server) RetrieveMessageForUser(name string, author *identity.Address, forAddr *identity.Address) *message.EncryptedMessage
RetrieveMessageForUser will retrieve the message stored for the specified user at the specified name.
func (*Server) RetrieveMessageListForUser ¶
func (m *Server) RetrieveMessageListForUser(since uint64, author *identity.Address, forAddr *identity.Address) []*message.EncryptedMessage
RetrieveMessageListForUser will return all the public messages that a User has access to sent after `since`.
func (*Server) SaveDataMessage ¶
func (m *Server) SaveDataMessage(name string, to []string, from string, message *message.EncryptedMessage, path string, length int64) error
Save Data Message
func (*Server) SaveIncomingMessage ¶
func (m *Server) SaveIncomingMessage(message *message.EncryptedMessage) error
Save Outgoing Message
func (*Server) SaveMessage ¶
func (m *Server) SaveMessage(name string, to []string, from string, message *message.EncryptedMessage, messageType int) error
Save Outgoing Message
func (*Server) SaveMessageDescription ¶
func (m *Server) SaveMessageDescription(alert *message.EncryptedMessage)
SaveMessageDescription will serialize a message description and add it to the database.