Documentation ¶
Overview ¶
Package venti is a group of libraries for writing venti(7) servers.
Index ¶
Constants ¶
const MaxFileSize = (1 << 48) - 1
MaxFileSize is the biggest file venti supports.
Variables ¶
var ( // ErrBadVersion is sent to the client if they attempt to initiate a // connection with no common version. ErrBadVersion = fmt.Errorf("no common version") )
Functions ¶
func ListenAndServe ¶
ListenAndServe listens on the TCP address "addr" and calls Serve on the resulting net.Listener.
func ParseVersion ¶
ParseVersion returns the versions out of a venti version string.
Types ¶
type Entry ¶
type Entry struct { Gen uint32 PoiterSize uint32 DataSize uint32 Type uint8 Flags uint8 Size uint64 Score Score }
Entry is a stub from libventi.h
type Handler ¶
type Handler interface { // Read requests the block identified by the provided score, type pair. The // count argument is the maximum expected size of the response. // // If the supplied io.Reader satifies the io.ReadCloser interface, Close will be // called when its consumed. Read(score Score, kind Type, count int64) (io.Reader, error) // Write requests that the provided data of the given type be written. // The returned score should be a hash of the data using the negotiated // algorithm. // // The passed-in io.Reader is only valid for the length of the function // call and should not be retained. Write(kind Type, data io.Reader) (Score, error) // Sync is called when the client has requested that the previous writes be // persisted. It should delay returning until this is done. Sync() error }
Handler is the interface a venti server implementation must provide.
Semantics documented here take precidence over those described in venti(7).
type Handshake ¶
Handshake takes the parameters sent by the client's hello, and returns a Handler if it can continue, or an error otherwise.
If a nil is returned instead of an Rhello struct, a default handshaking function will be used.
type Rhello ¶
type Rhello struct { // SID is the identity of the server. SID string // Crypto and Codec are the response to the crypto and compression // negotiation. Crypto uint8 Codec uint8 }
Rhello is the server's response to a Thello.
All current implementations ignore all these fields.
type Score ¶
type Score []byte
Score is the hash of a block.
Currently the score function clients recognize is SHA1.
func ParseScore ¶
ParseScore returns a score from its hex representation
type Thello ¶
type Thello struct { // UID is the identity of the connecting user. UID string // Strength is flags to negotiate authentication, encryption, and // compression. Strength uint8 // Crypto and Codec are arguments to the negotiation indicated by Strength Crypto []byte Codec []byte }
Thello is the client's hello message.
All current implementations ignore all these fields.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
devnull
Devnull is a reimplementation of src/venti/cmd/devnull.c.
|
Devnull is a reimplementation of src/venti/cmd/devnull.c. |
errsrv
Errsrv returns an error for all messages besides the initial handshake and pings.
|
Errsrv returns an error for all messages besides the initial handshake and pings. |
ping
Ping pings a venti server.
|
Ping pings a venti server. |
internal
|
|
msg
Package msg is all the wire types and their packing.
|
Package msg is all the wire types and their packing. |
pack
Package pack is the message packing scheme for venti, and some convenience functions for reading/writing venti packets.
|
Package pack is the message packing scheme for venti, and some convenience functions for reading/writing venti packets. |