Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReceiverRecord ¶
type ReceiverRecord struct { PrivateKey *rsa.PrivateKey // v1 TokenId ServiceTokenIdentifier // v2 Metadata interface{} }
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server represents a Votifier server.
func NewServer ¶
func NewServer(voteHandler VoteListener, records []ReceiverRecord) Server
NewServer creates a new Votifier server.
func (*Server) ListenAndServe ¶
ListenAndServe binds to a specified address-port pair and starts serving Votifier requests.
type ServiceTokenIdentifier ¶
ServiceTokenIdentifier defines a function for identifying a token for a service.
func StaticServiceTokenIdentifier ¶
func StaticServiceTokenIdentifier(token string) ServiceTokenIdentifier
StaticServiceTokenIdentifier returns a ServiceTokenIdentifier that returns a static token for any service.
type V1Client ¶
type V1Client struct {
// contains filtered or unexported fields
}
V1Client represents a Votifier v1 client.
func NewV1Client ¶
NewV1Client creates a new Votifier client.
type V2Client ¶
type V2Client struct {
// contains filtered or unexported fields
}
V2Client represents a Votifier v2 client.
func NewV2Client ¶
NewV2Client creates a new Votifier v2 client.
type Vote ¶
type Vote struct { // The name of the service the user is voting from. ServiceName string `json:"serviceName"` // The user's Minecraft username. Username string `json:"username"` // The voting user's IP address. Address string `json:"address"` // The timestamp this vote was issued. Timestamp string `json:"timeStamp"` }
Vote represents a Votifier vote.
type VoteListener ¶
type VoteListener func(Vote, VotifierProtocol, interface{})
VoteListener takes a vote and an int describing the protocol version (1 or 2).
type VotifierProtocol ¶
type VotifierProtocol int
const ( VotifierV1 VotifierProtocol = iota VotifierV2 VotifierProtocol = iota )