protocol

package
v0.1.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PakePayload

type PakePayload struct {
	Bytes []byte `json:"pake_bytes"`
}

type PasswordPayload

type PasswordPayload struct {
	Password string `json:"password"`
}

type ReceiverHandshakePayload

type ReceiverHandshakePayload struct {
	IP net.IP `json:"ip"`
}

type SaltPayload

type SaltPayload struct {
	Salt []byte `json:"salt"`
}

type SenderHandshakePayload

type SenderHandshakePayload struct {
	IP          net.IP `json:"ip"`
	Port        int    `json:"port"`
	PayloadSize int64  `json:"payload_size"`
}

SenderHandshakePayload specifies a payload type for announcing the payload size.

type TransferMessage

type TransferMessage struct {
	Type    TransferMessageType `json:"type"`
	Payload interface{}         `json:"payload,omitempty"`
}

TransferMessage specifies a message in the transfer protocol.

func (TransferMessage) Bytes

func (t TransferMessage) Bytes() []byte

type TransferMessageType

type TransferMessageType int

TransferMessageType specifies the message type for the messages in the transfer protocol.

const (
	TransferError     TransferMessageType = iota // An error has occured in transferProtocol
	ReceiverHandshake                            // Receiver exchange its IP via the tranx server to the sender
	SenderHandshake                              // Sender exchanges IP, port and payload size to the receiver via the tranx server
	ReceiverDirectCommunication
	SenderDirectAck            // Sender ACKs the request for direct communication
	ReceiverRelayCommunication // Receiver has tried to probe the sender but cannot find it on the subnet, relay communication will be used
	SenderRelayAck             // Sender ACKs the request for relay communication
	ReceiverRequestPayload     // Receiver request the payload from the sender
	SenderPayloadSent          // Sender announces that the entire file has been transfered
	ReceiverPayloadAck         // Receiver ACKs that is has received the payload
	SenderClosing              // Sender announces that it is closing the connection
	ReceiverClosingAck         // Receiver ACKs the closing of the connection
)

func (TransferMessageType) Name

func (t TransferMessageType) Name() string

type TranxClient

type TranxClient struct {
	Conn *websocket.Conn
	IP   net.IP
}

type TranxMessage

type TranxMessage struct {
	Type    TranxMessageType `json:"type"`
	Payload interface{}      `json:"payload"`
}

type TranxMessageType

type TranxMessageType int
const (
	TranxToSenderBind        TranxMessageType = iota // An ID for this connection is bound and communicated
	SenderToTranxEstablish                           // Sender has generated and hashed password
	ReceiverToTranxEstablish                         // Passsword has been communicated to receiver who has hashed it
	TranxToSenderReady                               // Tranx announces to sender that receiver is connected
	SenderToTranxPAKE                                // Sender sends PAKE information to tranx
	TranxToReceiverPAKE                              // Tranx forwards PAKE information to receiver
	ReceiverToTranxPAKE                              // Receiver sends PAKE information to tranx
	TranxToSenderPAKE                                // Tranx forwards PAKE information to receiver
	SenderToTranxSalt                                // Sender sends cryptographic salt to tranx
	TranxToReceiverSalt                              // Rendevoux forwards cryptographic salt to receiver
	ReceiverToTranxClose                             // Receiver can connect directly to sender, close receiver connection -> close sender connection
	SenderToTranxClose                               // Transit sequence is completed, close sender connection -> close receiver connection
)

type TranxReceiver

type TranxReceiver = TranxClient

type TranxSender

type TranxSender struct {
	TranxClient
	Port int
}

type TranxToSenderBindPayload

type TranxToSenderBindPayload struct {
	ID int `json:"id"`
}

type WrongMessageTypeError

type WrongMessageTypeError struct {
	// contains filtered or unexported fields
}

func NewWrongMessageTypeError

func NewWrongMessageTypeError(expected []TransferMessageType, got TransferMessageType) *WrongMessageTypeError

func (*WrongMessageTypeError) Error

func (e *WrongMessageTypeError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL