Documentation ¶
Index ¶
- Variables
- func EmblemUDPServer(signer gen.TokenGenerator, endorsements [][]byte, port int, timeout int64, ...)
- func FromPacket(packet []byte) (uint16, int, []byte, error)
- func PacketForToken(rawToken []byte, totalNum uint16) tokenPacket
- func UDPProbe(listenPort int, probeAddr *net.UDPAddr, timeout int64, ...)
- func WatchSyslog(file *os.File, emblemPort int, c chan *net.UDPAddr)
- type EmblemRefresher
- type TokenSet
Constants ¶
This section is empty.
Variables ¶
var ErrPacketTooShort = errors.New("packet is too short to contain token")
Functions ¶
func EmblemUDPServer ¶
func EmblemUDPServer(signer gen.TokenGenerator, endorsements [][]byte, port int, timeout int64, c chan *net.UDPAddr, wg *sync.WaitGroup)
Emblem distributing UDP server. Listens to the given port and to the given channel. Sends emblems to every address it receives over the given channel, but each address only once per timeout.
func FromPacket ¶
Parses a packet that was assembled by PacketForToken and [Prep]. Returns the sequence number, number of tokens to be expected in total, and the token.
func PacketForToken ¶
Encodes a token that will be accompanied by totalNum many other tokens as a packet. Call [Prep] before sending the packet.
Types ¶
type EmblemRefresher ¶
type EmblemRefresher struct {
// contains filtered or unexported fields
}
func MkRefresher ¶
func MkRefresher(cfg *gen.EmblemConfig, threshold int64) *EmblemRefresher
Returns an instance of gen.TokenGenerator. Generates an emblem according to the given gen.EmblemConfig but only every threshold many seconds. Calls to SignToken() will return the most recently signed token.