Documentation
¶
Index ¶
- Constants
- func MarshalFrame(frame Frame) (frameData []byte, err error)
- func WriteMarshalFrame(writer *fsock.Writer, frame Frame) (nn int, err error)
- type DataFrame
- type Frame
- type FrameAccept
- type FrameHTTPReqBody
- type FrameHTTPReqEnd
- type FrameHTTPReqHead
- type FrameHTTPResBody
- type FrameHTTPResEnd
- type FrameHTTPResHead
- type FrameHTTPResWant
- type FrameIAm
- type FrameKind
- type FrameMount
- type FrameNeedBand
- type FrameUnmount
Constants ¶
const ( /* these numbers are part of the protocol and incredibly importatnt. Do * not make this an enum with iota. */ ConnKindCell = 0x0 ConnKindBand = 0x1 )
A connection can be for a cell, or a band. These constants store the * connection kind numbers.
Variables ¶
This section is empty.
Functions ¶
func MarshalFrame ¶
MarshalFrame takes in a struct satisfying the Frame interface and endcodes it * into a valid frame.
Types ¶
type DataFrame ¶
type DataFrame interface {
GetData() []byte
}
DataFrame is a specific type of frame which can store arbitrary data.
type Frame ¶
type Frame interface {
Kind() FrameKind
}
Frame represents a singular block of data sent between cells.
type FrameAccept ¶
FrameAccept is sent from the queen to the client cell, assigning the cell a * UUID and session key that it can use to create bands later.
func (*FrameAccept) Kind ¶
func (frame *FrameAccept) Kind() FrameKind
type FrameHTTPReqBody ¶
type FrameHTTPReqBody struct {
Data []byte
}
FrameHTTPReqBody is sent from the queen to the client cell after the cell * asks for the HTTP body. It contains a single chunk of the body, and is often * sent mulitple times in a row. The cell should stitch these together until * it receives FrameHTTPReqEnd.
func (*FrameHTTPReqBody) GetData ¶
func (frame *FrameHTTPReqBody) GetData() []byte
These functions return the arbitrary data stored in data frames.
func (*FrameHTTPReqBody) Kind ¶
func (frame *FrameHTTPReqBody) Kind() FrameKind
type FrameHTTPReqEnd ¶
type FrameHTTPReqEnd struct{}
FrameHTTPReqEnd is sent from the queen to the client cell when there is no * more HTTP body data left.
func (*FrameHTTPReqEnd) Kind ¶
func (frame *FrameHTTPReqEnd) Kind() FrameKind
type FrameHTTPReqHead ¶
type FrameHTTPReqHead struct {
RemoteAddrReal string `json:"remoteAddrReal"`
RemoteAddr string `json:"remoteAddr"`
Method string `json:"method"`
Scheme string `json:"scheme"`
Host string `json:"host"`
Port int `json:"port"`
Path string `json:"path"`
Fragment string `json:"fragment"`
Query map[string][]string `json:"query"`
Proto string `json:"proto"`
ProtoMajor int `json:"protoMajor"`
ProtoMinor int `json:"protoMinor"`
Headers map[string][]string `json:"headers"`
}
FrameHTTPReqHead is sent from the queen to the client cell when the queen * receives an HTTP request and has determined that this cell should handle it. * It contains extensive information about the request. If the cell wants the * HTTP body to be sent to it, it must specifically request it.
func (*FrameHTTPReqHead) Kind ¶
func (frame *FrameHTTPReqHead) Kind() FrameKind
type FrameHTTPResBody ¶
type FrameHTTPResBody struct {
Data []byte
}
FrameHTTPResBody is sent from the client cell to the queen. It contains a * chunk of the HTTP response body data that should be written to the client. * The queen, upon receiving this, should send it to the HTTP client. This frame * should not precede FrameHTTPResHead.
func (*FrameHTTPResBody) GetData ¶
func (frame *FrameHTTPResBody) GetData() []byte
func (*FrameHTTPResBody) Kind ¶
func (frame *FrameHTTPResBody) Kind() FrameKind
type FrameHTTPResEnd ¶
type FrameHTTPResEnd struct{}
FrameHTTPResEnd is sent from the client cell to the queen as a signal that * the entirety of the HTTP response body has been sent, and the connection to * the HTTP client should be closed.
func (*FrameHTTPResEnd) Kind ¶
func (frame *FrameHTTPResEnd) Kind() FrameKind
type FrameHTTPResHead ¶
type FrameHTTPResHead struct {
StatusCode int `json:"statusCode"`
Headers map[string][]string `json:"headers"`
}
FrameHTTPResHead is sent from the client cell to the queen. It contains * information such as the status code, and headers. It signals to the queen * that it should begin responding to the HTTP client.
func (*FrameHTTPResHead) Kind ¶
func (frame *FrameHTTPResHead) Kind() FrameKind
type FrameHTTPResWant ¶
type FrameHTTPResWant struct {
MaxSize int `json:"maxSize"`
}
FrameHTTPResWant is sent from the client cell to the queen as a request for * the HTTP request body data. The cell must specify a maximum size. The queen, * upon receiving this, will begin sending the HTTP body in chunks.
func (*FrameHTTPResWant) Kind ¶
func (frame *FrameHTTPResWant) Kind() FrameKind
type FrameIAm ¶
type FrameIAm struct {
ConnKind int `json:"connKind"`
Uuid string `json:"uuid"`
Key string `json:"key"`
}
FrameIAm is sent from the client cell to the queen in order to initiate a * connection.
type FrameKind ¶
type FrameKind byte
FrameKind determines what a Frame interface should be cast to.
const ( /* these numbers are part of the protocol and incredibly importatnt. Do * not make this an enum with iota. */ // authentication/setup FrameKindIAm FrameKind = 0x00 FrameKindAccept FrameKind = 0x08 // mounting FrameKindMount FrameKind = 0x10 FrameKindUnmount FrameKind = 0x11 // resource requesting FrameKindNeedBand FrameKind = 0x20 // http FrameKindHTTPReqHead FrameKind = 0x30 FrameKindHTTPReqBody FrameKind = 0x31 FrameKindHTTPReqEnd FrameKind = 0x32 FrameKindHTTPResWant FrameKind = 0x38 FrameKindHTTPResHead FrameKind = 0x39 FrameKindHTTPResBody FrameKind = 0x3A FrameKindHTTPResEnd FrameKind = 0x3B )
func ParseFrame ¶
ParseFrame splits a frame into its kind and its data. Unmarshaling should be * conducted by the handler.
type FrameMount ¶
FrameMount is sent from the client cell to the queen. It contains information * about the location the cell wants to mount on.
func (*FrameMount) Kind ¶
func (frame *FrameMount) Kind() FrameKind
type FrameNeedBand ¶
type FrameNeedBand struct {
Count int `json:"count"`
}
FrameNeedBand is sent from the queen to the client cell when the queen * detects that more bands are needed to keep the connection running smoothly. * The cell is expected to immediately create and connect a new band to the * queen.
func (*FrameNeedBand) Kind ¶
func (frame *FrameNeedBand) Kind() FrameKind
type FrameUnmount ¶
type FrameUnmount struct{}
FrameUnmount is sent from the client cell to the queen. Upon receiving this, * the queen will unmount the cell from its current mount point.
func (*FrameUnmount) Kind ¶
func (frame *FrameUnmount) Kind() FrameKind