// Creates and returns a new Tcp. func NewTCP(p protos.Protocols) (*TCP, error) { isDebug = logp.IsDebug("tcp") 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) if isDebug { debugf("tcp", "Port map: %v", portMap) } return tcp, nil }