dispatcher

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2015 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TableNameUser        = "melange_user"
	TableNameIdentity    = "melange_identity"
	TableNameMessage     = "melange_message"
	TableNameStorage     = "melange_storage"
	TableNameDataMessage = "melange_data_msg"
)

Table Names

View Source
const (
	PKUser        = "Id"
	PKIdentity    = "Id"
	PKMessage     = "Id"
	PKStorage     = "Id"
	PKDataMessage = "Id"
)

Primary Key Names

View Source
const (
	TypeOutgoingPublic = iota
	TypeOutgoingPrivate
	TypeIncoming
)
View Source
const QueryAnyNamed = "select * from " + TableNameMessage + " o where o.Owner = :owner and o.Name = :name"
View Source
const QueryDataMessage = "select * from " + TableNameDataMessage + " o where o.Owner = :owner and o.Name = :name and (o.To like :recv or o.To = '')"
View Source
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"
View Source
const QueryIncoming = "select * from " + TableNameMessage + " o where o.To like :owner and o.Received > :time and o.Type = 2"
View Source
const QueryOutgoing = "select * from " + TableNameMessage + " o where o.Owner = :owner and (o.Type = 0 or o.Type = 1) and o.Received > :time"
View Source
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))"
View Source
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"
View Source
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 Identity

type Identity struct {
	// Signing Key and Encryption Key
	Id         int
	Owner      int
	Signing    string
	Encrypting []byte
}

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) CreateTables

func (s *Server) CreateTables()

Create the Table Objects

func (*Server) GetAnyMessageWithName

func (m *Server) GetAnyMessageWithName(name string, owner string) (*Message, error)

func (*Server) GetData

func (m *Server) GetData(author string, key string) ([]byte, error)

func (*Server) GetDataMessageNamed

func (m *Server) GetDataMessageNamed(name string, owner string, receiver string) (*File, error)

Return Outgoing Message Named

func (*Server) GetIncomingMessagesSince

func (m *Server) GetIncomingMessagesSince(since uint64, owner string) ([]*Message, error)

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 (m *Server) GetOutgoingMessagesFor(since uint64, owner string) ([]*Message, error)

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 (m *Server) PublishMessage(name string, to []string, author string, message *message.EncryptedMessage, alerted bool) error

func (*Server) Register

func (m *Server) Register(user string, keys map[string][]byte) error

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) Run

func (m *Server) Run(port int) error

Run will start the server with the specified database model.

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.

func (*Server) SetData

func (m *Server) SetData(author string, key string, data []byte) error

func (*Server) Unregister

func (m *Server) Unregister(user string, keys map[string][]byte) error

func (*Server) UpdateMessage

func (m *Server) UpdateMessage(name string, author string, message *message.EncryptedMessage) error

func (*Server) UserForIdentity

func (m *Server) UserForIdentity(id string) (*User, error)

type Storage

type Storage struct {
	Id    int
	Key   string
	Value []byte
	Owner int
}

type User

type User struct {
	Id           int
	Name         string
	Receiving    string
	RegisteredOn int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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