Documentation
¶
Index ¶
- type ContentDistribution
- type HeaderDataFormat
- type HeaderToken
- type Message
- func (msg *Message) AddCloseConnectionHeader()
- func (msg *Message) AddContentTypeHeader(contentType string)
- func (msg *Message) AddCustomHeader(headerName string, headerValue string)
- func (msg *Message) AddStatusCodeHeader(isError bool)
- func (msg *Message) AddStatusPhraseHeader(statusPhrase string)
- func (msg *Message) AddURIHeader(uri string, headerToken HeaderToken)
- func (msg *Message) GetMessage(data string) string
- func (msg *Message) WriteDefaultPreamble(uri string, opType OperationType, dataLength int)
- func (msg *Message) WritePreamble(uri string, opType OperationType, dataLength int, ...)
- type MessageResponse
- type OperationType
- type StringEncoding
- type TCPStatusCode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContentDistribution ¶
type ContentDistribution string
const ( ContentDistributionNotChunked ContentDistribution = "\x00\x00" ContentDistributionChunked ContentDistribution = "\x01\x00" )
type HeaderDataFormat ¶
type HeaderDataFormat string
const ( HeaderDataFormatVoid HeaderDataFormat = "\x00" HeaderDataFormatCountedString HeaderDataFormat = "\x01" HeaderDataFormatByte HeaderDataFormat = "\x02" HeaderDataFormatUint16 HeaderDataFormat = "\x03" HeaderDataFormatInt32 HeaderDataFormat = "\x04" )
type HeaderToken ¶
type HeaderToken string
const ( HeaderTokenEndHeaders HeaderToken = "\x00\x00" HeaderTokenCustom HeaderToken = "\x01\x00" HeaderTokenStatusCode HeaderToken = "\x02\x00" HeaderTokenStatusPhrase HeaderToken = "\x03\x00" HeaderTokenRequestURI HeaderToken = "\x04\x00" HeaderTokenCloseConnection HeaderToken = "\x05\x00" HeaderTokenContentType HeaderToken = "\x06\x00" )
type Message ¶
types and 'enums'.
func (*Message) AddCloseConnectionHeader ¶
func (msg *Message) AddCloseConnectionHeader()
func (*Message) AddContentTypeHeader ¶
this will probably be application/octet-stream almost every time but making options.
func (*Message) AddCustomHeader ¶
uri in this case should probably look something like tcp://1.2.3.4:2814/SomeEndpoint
func (*Message) AddStatusCodeHeader ¶
func (*Message) AddStatusPhraseHeader ¶
func (*Message) AddURIHeader ¶
func (msg *Message) AddURIHeader(uri string, headerToken HeaderToken)
uri in this case should probably look something like tcp://1.2.3.4:2814/SomeEndpoint
func (*Message) GetMessage ¶
Run this when you are finished putting headers and such together. This function will also add the end header so you should not write that part anywhere else. Obviously pass "" as the arg if you do not have data to add.
func (*Message) WriteDefaultPreamble ¶
func (msg *Message) WriteDefaultPreamble(uri string, opType OperationType, dataLength int)
Can be used for 'most' things, otherwise use WritePreamble.
func (*Message) WritePreamble ¶
func (msg *Message) WritePreamble(uri string, opType OperationType, dataLength int, contentDistribution ContentDistribution, contentType string)
The 'preamble' is basically the set of headers before the body.
type MessageResponse ¶
type MessageResponse struct { MajorVersion string MinorVersion string OperationType string ContentDistribution string DataLength int Headers map[string]string Data string }
Strings, because go thinks strings are as nifty as bytes.
func ParseResponseFromConn ¶
func ParseResponseFromConn(conn net.Conn) (MessageResponse, bool)
Parsing functions.
func (*MessageResponse) Dump ¶
func (msg *MessageResponse) Dump()
type OperationType ¶
type OperationType string
const ( OperationTypeRequest OperationType = "\x00\x00" OperationTypeOneWayRequest OperationType = "\x01\x00" OperationTypeReply OperationType = "\x02\x00" )
type StringEncoding ¶
type StringEncoding string
const ( StringEncodingUnicode StringEncoding = "\x00" StringEncodingUtf8 StringEncoding = "\x01" )
type TCPStatusCode ¶
type TCPStatusCode string
const ( TCPStatusCodeSuccess TCPStatusCode = "\x00" TCPStatusCodeError TCPStatusCode = "\x01" )