Documentation
¶
Index ¶
- Constants
- Variables
- func CraftEndpointInfo(r rand.Random, hostname string, device qshare.DeviceType) []byte
- type Adapter
- func (a *Adapter) Disconnect()
- func (a *Adapter) EnableEncryption() error
- func (a *Adapter) EnableTransferHandler()
- func (a *Adapter) Pin() uint16
- func (a *Adapter) ProcessServiceMessage(msg []byte) error
- func (a *Adapter) Reader(ctx context.Context) func() ([]byte, error)
- func (a *Adapter) SendBadMessageError()
- func (a *Adapter) SendClientInitWithClientFinished() error
- func (a *Adapter) SendConnRequest(endpointID, hostname string, device qshare.DeviceType) error
- func (a *Adapter) SendConnResponse(isAccepted bool) error
- func (a *Adapter) SendDataInChunks(payloadID int64, data []byte) error
- func (a *Adapter) SendFileInChunks(payloadID int64, file qshare.FilePayload) error
- func (a *Adapter) SendIntroduction(frame IntroductionFrame) error
- func (a *Adapter) SendPairedKeyEncryption() error
- func (a *Adapter) SendPairedKeyResult() error
- func (a *Adapter) SendServerInit() error
- func (a *Adapter) SendTransferRequest() error
- func (a *Adapter) SendTransferResponse(isAccepted bool) error
- func (a *Adapter) UnmarshalConnRequest(msg []byte) (ConnRequest, error)
- func (a *Adapter) UnmarshalConnResponse(msg []byte) (ConnResponse, error)
- func (a *Adapter) UnmarshalIntroduction(msg []byte) (IntroductionFrame, error)
- func (a *Adapter) UnmarshalTransferResponse(msg []byte) (bool, error)
- func (a *Adapter) ValidateClientFinished(msg []byte) error
- func (a *Adapter) ValidateClientInit(msg []byte) error
- func (a *Adapter) ValidatePairedKeyEncryption(msg []byte) error
- func (a *Adapter) ValidatePairedKeyResult(msg []byte) error
- func (a *Adapter) ValidateServerInit(msg []byte) error
- func (a *Adapter) ValidateTransferRequest(msg []byte) error
- type ConnRequest
- type ConnResponse
- type FileChunk
- type FileChunkCallback
- type IntroductionFrame
- type TextMeta
- type TextTransferCallback
Constants ¶
View Source
const ( MAX_MESSAGE_LENGTH = 5 * 1024 * 1024 // 5Mb MAX_TEXT_LENGTH = 5 * 1024 * 1024 // 5Mb )
TODO: fine tune all of the buffer sizes
View Source
const FILE_CHUNK_SIZE = 512 * 1024 // 512 KB
Variables ¶
View Source
var ( ErrConnWasEndedByClient = errors.New("connection was ended by client") ErrNotServiceMessage = errors.New("message is not service message") ErrInvalidMessageLength = errors.New("invalid message length") ErrMessageTooLong = errors.New("message to long") ErrOffsetMismatch = errors.New("new chunk offset not expected") ErrFetchFullMessage = errors.New("cannot fetch full message") )
Functions ¶
func CraftEndpointInfo ¶
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
func New ¶
func New( conn net.Conn, logger qshare.Logger, isServer bool, fileChunkCallback FileChunkCallback, textTransferCallback TextTransferCallback, r rand.Random, ) Adapter
func (*Adapter) Disconnect ¶
func (a *Adapter) Disconnect()
func (*Adapter) EnableEncryption ¶
func (*Adapter) EnableTransferHandler ¶
func (a *Adapter) EnableTransferHandler()
func (*Adapter) ProcessServiceMessage ¶
func (*Adapter) SendBadMessageError ¶
func (a *Adapter) SendBadMessageError()
func (*Adapter) SendClientInitWithClientFinished ¶
func (*Adapter) SendConnRequest ¶
func (a *Adapter) SendConnRequest(endpointID, hostname string, device qshare.DeviceType) error
func (*Adapter) SendConnResponse ¶
func (*Adapter) SendDataInChunks ¶
func (*Adapter) SendFileInChunks ¶
func (a *Adapter) SendFileInChunks(payloadID int64, file qshare.FilePayload) error
func (*Adapter) SendIntroduction ¶
func (a *Adapter) SendIntroduction(frame IntroductionFrame) error
func (*Adapter) SendPairedKeyEncryption ¶
func (*Adapter) SendPairedKeyResult ¶
func (*Adapter) SendServerInit ¶
func (*Adapter) SendTransferRequest ¶
func (*Adapter) SendTransferResponse ¶
func (*Adapter) UnmarshalConnRequest ¶
func (a *Adapter) UnmarshalConnRequest(msg []byte) (ConnRequest, error)
func (*Adapter) UnmarshalConnResponse ¶
func (a *Adapter) UnmarshalConnResponse(msg []byte) (ConnResponse, error)
func (*Adapter) UnmarshalIntroduction ¶
func (a *Adapter) UnmarshalIntroduction(msg []byte) (IntroductionFrame, error)
TODO: SECURITY: - sanitize all strings
func (*Adapter) UnmarshalTransferResponse ¶
func (*Adapter) ValidateClientFinished ¶
func (*Adapter) ValidateClientInit ¶
func (*Adapter) ValidatePairedKeyEncryption ¶
func (*Adapter) ValidatePairedKeyResult ¶
func (*Adapter) ValidateServerInit ¶
func (*Adapter) ValidateTransferRequest ¶
type ConnRequest ¶
type ConnRequest struct {
EndpointInfo []byte
}
type ConnResponse ¶
type ConnResponse struct {
IsConnAccepted bool
}
type FileChunkCallback ¶
type IntroductionFrame ¶
type IntroductionFrame struct { Text *TextMeta Files map[int64]*qshare.FilePayload }
func (IntroductionFrame) HasFiles ¶
func (f IntroductionFrame) HasFiles() bool
func (IntroductionFrame) HasText ¶
func (f IntroductionFrame) HasText() bool
type TextTransferCallback ¶
Click to show internal directories.
Click to hide internal directories.