Packets returns a channel of packets, allowing easy iterating over packets. Packets will be asynchronously read in from the underlying PacketDataSource and written to the returned channel. If the underlying PacketDataSource returns an io.EOF error, the channel will be closed. If any other error is
()
| 856 | // |
| 857 | // If called more than once, returns the same channel. |
| 858 | func (p *PacketSource) Packets() chan Packet { |
| 859 | if p.c == nil { |
| 860 | p.c = make(chan Packet, 1000) |
| 861 | go p.packetsToChannel() |
| 862 | } |
| 863 | return p.c |
| 864 | } |