Documentation
¶
Index ¶
- Constants
- Variables
- func Handle(log *slog.Logger, conn net.Conn, exports []*Export, options *Options) error
- func HandleTransport(log *slog.Logger, conn net.Conn, backend Backend, options *Options) error
- type Backend
- type BackendOpen
- type Export
- type NegotiationNewstyleHeader
- type NegotiationOptionHeader
- type NegotiationReplyBlockSize
- type NegotiationReplyDescriptionHeader
- type NegotiationReplyHeader
- type NegotiationReplyInfo
- type NegotiationReplyNameHeader
- type Options
- type TransmissionReplyHeader
- type TransmissionRequestHeader
Constants ¶
View Source
const ( NEGOTIATION_MAGIC_OLDSTYLE = uint64(0x4e42444d41474943) NEGOTIATION_MAGIC_OPTION = uint64(0x49484156454F5054) NEGOTIATION_MAGIC_REPLY = uint64(0x3e889045565a9) NEGOTIATION_HANDSHAKE_FLAG_FIXED_NEWSTYLE = uint16(1 << 0) NEGOTIATION_ID_OPTION_ABORT = uint32(2) NEGOTIATION_ID_OPTION_LIST = uint32(3) NEGOTIATION_ID_OPTION_INFO = uint32(6) NEGOTIATION_ID_OPTION_GO = uint32(7) NEGOTIATION_TYPE_REPLY_ACK = uint32(1) NEGOTIATION_TYPE_REPLY_SERVER = uint32(2) NEGOTIATION_TYPE_REPLY_INFO = uint32(3) NEGOTIATION_TYPE_REPLY_ERR_UNSUPPORTED = uint32(1 | uint32(1<<31)) NEGOTIATION_TYPE_REPLY_ERR_UNKNOWN = uint32(6 | uint32(1<<31)) NEGOTIATION_TYPE_INFO_EXPORT = uint16(0) NEGOTIATION_TYPE_INFO_NAME = uint16(1) NEGOTIATION_TYPE_INFO_DESCRIPTION = uint16(2) NEGOTIATION_TYPE_INFO_BLOCKSIZE = uint16(3) NEGOTIATION_REPLY_FLAGS_HAS_FLAGS = uint16((1 << 0)) NEGOTIATION_REPLY_FLAGS_CAN_MULTI_CONN = uint16((1 << 8)) NEGO_FLAG_READONLY = uint16(1 << 1) NEGO_FLAG_SEND_FLUSH = uint16(1 << 2) NEGO_FLAG_SEND_FUA = uint16(1 << 3) NEGO_FLAG_ROTATIONAL = uint16(1 << 4) NEGO_FLAG_SEND_TRIM = uint16(1 << 5) NEGO_FLAG_SEND_WRITE_ZEROES = uint16(1 << 6) NEGO_FLAG_SEND_DF = uint16(1 << 7) NEGO_FLAG_SEND_RESIZE = uint16(1 << 9) NEGO_FLAG_SEND_CACHE = uint16(1 << 10) NEGO_FLAG_FAST_ZERO = uint16(1 << 11) NEGO_FLAG_BLOCK_STATUS = uint16(1 << 12) )
View Source
const ( TRANSMISSION_MAGIC_REQUEST = uint32(0x25609513) TRANSMISSION_MAGIC_REPLY = uint32(0x67446698) TRANSMISSION_TYPE_REQUEST_READ = uint16(0) TRANSMISSION_TYPE_REQUEST_WRITE = uint16(1) TRANSMISSION_TYPE_REQUEST_DISC = uint16(2) TRANSMISSION_TYPE_REQUEST_FLUSH = uint16(3) TRANSMISSION_TYPE_REQUEST_TRIM = uint16(4) TRANSMISSION_TYPE_REQUEST_CACHE = uint16(5) TRANSMISSION_TYPE_REQUEST_WRITEZ = uint16(6) TRANSMISSION_TYPE_REQUEST_STATUS = uint16(7) TRANSMISSION_ERROR_EPERM = uint32(1) TRANSMISSION_ERROR_EINVAL = uint32(22) )
View Source
const (
MaxInsaneLength = 512 * 1024 * 1024 // Reject requests larger than 512M as insane
)
Variables ¶
View Source
var ( ErrInvalidMagic = errors.New("invalid magic") ErrInvalidBlocksize = errors.New("invalid blocksize") )
Functions ¶
Types ¶
type BackendOpen ¶
type Export ¶
type Export struct {
Name string
Description string
BackendOpen BackendOpen
Backend Backend
}
type NegotiationOptionHeader ¶
type NegotiationReplyDescriptionHeader ¶
type NegotiationReplyDescriptionHeader NegotiationReplyNameHeader
type NegotiationReplyHeader ¶
type NegotiationReplyInfo ¶
type NegotiationReplyNameHeader ¶
type NegotiationReplyNameHeader struct {
Type uint16
}
type TransmissionReplyHeader ¶
Click to show internal directories.
Click to hide internal directories.