Source File
extensions.go
Belonging Package
github.com/pkg/sftp/internal/encoding/ssh/filexfer
package sshfx// ExtensionPair defines the extension-pair type defined in draft-ietf-secsh-filexfer-13.// This type is backwards-compatible with how draft-ietf-secsh-filexfer-02 defines extensions.//// Defined in: https://tools.ietf.org/html/draft-ietf-secsh-filexfer-13#section-4.2type ExtensionPair struct {Name stringData string}// Len returns the number of bytes e would marshal into.func ( *ExtensionPair) () int {return 4 + len(.Name) + 4 + len(.Data)}// MarshalInto marshals e onto the end of the given Buffer.func ( *ExtensionPair) ( *Buffer) {.AppendString(.Name).AppendString(.Data)}// MarshalBinary returns e as the binary encoding of e.func ( *ExtensionPair) () ([]byte, error) {:= NewBuffer(make([]byte, 0, .Len())).MarshalInto()return .Bytes(), nil}// UnmarshalFrom unmarshals an ExtensionPair from the given Buffer into e.func ( *ExtensionPair) ( *Buffer) ( error) {* = ExtensionPair{Name: .ConsumeString(),Data: .ConsumeString(),}return .Err}// UnmarshalBinary decodes the binary encoding of ExtensionPair into e.func ( *ExtensionPair) ( []byte) error {return .UnmarshalFrom(NewBuffer())}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |