Пример #1
0
// NewUdp creates and returns a new Udp.
func NewUdp(p protos.Protocols) (*Udp, error) {
	portMap, err := buildPortsMap(p.GetAllUdp())
	if err != nil {
		return nil, err
	}

	udp := &Udp{protocols: p, portMap: portMap}
	logp.Debug("udp", "Port map: %v", portMap)

	return udp, nil
}
Пример #2
0
// Creates and returns a new Tcp.
func NewTcp(p protos.Protocols) (*Tcp, error) {
	portMap, err := buildPortsMap(p.GetAllTcp())
	if err != nil {
		return nil, err
	}

	tcp := &Tcp{protocols: p, portMap: portMap}
	tcp.streamsMap = make(map[common.HashableIpPortTuple]*TcpStream, TCP_STREAM_HASH_SIZE)
	logp.Debug("tcp", "Port map: %v", portMap)

	return tcp, nil
}
Пример #3
0
// Creates and returns a new Tcp.
func NewTcp(p protos.Protocols) (*Tcp, error) {
	portMap, err := buildPortsMap(p.GetAllTcp())
	if err != nil {
		return nil, err
	}

	tcp := &Tcp{
		protocols: p,
		portMap:   portMap,
		streams: common.NewCache(protos.DefaultTransactionExpiration,
			protos.DefaultTransactionHashSize),
	}
	tcp.streams.StartJanitor(protos.DefaultTransactionExpiration)
	logp.Debug("tcp", "Port map: %v", portMap)

	return tcp, nil
}