Documentation
¶
Overview ¶
Package wire reads FIX messages off a byte stream, names every tag in them, and sits between two FIX engines as a tap that can lose messages on purpose.
Nothing here speaks FIX the way an engine does: no sequence numbers are kept, nothing is answered, nothing is resent. The tap only forwards whole messages or withholds them, so every recovery a reader sees after a withheld message is the engines' own.
Index ¶
Constants ¶
const SOH = 0x01
SOH is FIX's field delimiter, byte 0x01.
Variables ¶
var ErrFrame = errors.New("not a FIX message")
ErrFrame is a stream that is not a sequence of FIX 4.4 messages.
Functions ¶
Types ¶
type Field ¶
type Field struct {
Tag int `json:"tag"`
Name string `json:"name"`
Value string `json:"value"`
Meaning string `json:"meaning,omitempty"`
}
Field is one tag=value pair with its dictionary name, and the name of the value when the dictionary enumerates it (ExecType 0 is "NEW").
type Frame ¶
type Frame struct {
Dir Dir
Raw []byte
At time.Time
Dropped bool
// Why is set on a dropped frame: "drop-next" or "silent".
Why string
}
Frame is one whole message the tap saw. Dropped is true when the tap withheld it, so the other engine never received it.
type Message ¶
type Message struct {
MsgType string `json:"msg_type"`
Name string `json:"name"`
Seq int `json:"seq"`
PossDup bool `json:"poss_dup"`
Pipe string `json:"pipe"`
Fields []Field `json:"fields"`
}
Message is a decoded message.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader splits a stream into whole messages.
type Tap ¶
type Tap struct {
// contains filtered or unexported fields
}
Tap is a TCP relay for one FIX connection at a time: the initiator dials Addr, the tap dials the acceptor, and whole messages are copied across.
DropNext withholds the next whole outbound message, once. Silence withholds every outbound message until it is lifted, which to the acceptor looks like a client that stopped talking. The tap never alters a message it forwards and never writes one of its own.
func NewTap ¶
NewTap listens on 127.0.0.1 and relays each connection to upstream. onFrame is called for every message in either direction, from the relay goroutines, in the order that direction carried them.
func (*Tap) Close ¶
func (t *Tap) Close()
Close stops listening and closes every relayed connection.
func (*Tap) DropNext ¶
func (t *Tap) DropNext()
DropNext arms a one-shot drop of the next outbound message.