free tcp sessions after reassembly
parent
46b52b6a5f
commit
35bbfbb52d
15
d4-tlsf.go
15
d4-tlsf.go
|
@ -49,6 +49,11 @@ var jobQ chan d4tls.TLSSession
|
||||||
const closeTimeout time.Duration = time.Hour * 24 // Closing inactive: TODO: from CLI
|
const closeTimeout time.Duration = time.Hour * 24 // Closing inactive: TODO: from CLI
|
||||||
const timeout time.Duration = time.Minute * 5 // Pending bytes: TODO: from CLI
|
const timeout time.Duration = time.Minute * 5 // Pending bytes: TODO: from CLI
|
||||||
|
|
||||||
|
var assemblerOptions = reassembly.AssemblerOptions{
|
||||||
|
MaxBufferedPagesPerConnection: 16,
|
||||||
|
MaxBufferedPagesTotal: 0, // unlimited
|
||||||
|
}
|
||||||
|
|
||||||
var outputLevel int
|
var outputLevel int
|
||||||
var errorsMap map[string]uint
|
var errorsMap map[string]uint
|
||||||
var errorsMapMutex sync.Mutex
|
var errorsMapMutex sync.Mutex
|
||||||
|
@ -230,11 +235,12 @@ func getIPPorts(t *tcpStream) (string, string, string, string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *tcpStream) ReassemblyComplete(ac reassembly.AssemblerContext) bool {
|
func (t *tcpStream) ReassemblyComplete(ac reassembly.AssemblerContext) bool {
|
||||||
// do not remove the connection to allow last ACK
|
// remove connection from the pool
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
defer util.Run()()
|
defer util.Run()()
|
||||||
var handle *pcap.Handle
|
var handle *pcap.Handle
|
||||||
var err error
|
var err error
|
||||||
|
@ -275,6 +281,7 @@ func main() {
|
||||||
streamFactory := &tcpStreamFactory{}
|
streamFactory := &tcpStreamFactory{}
|
||||||
streamPool := reassembly.NewStreamPool(streamFactory)
|
streamPool := reassembly.NewStreamPool(streamFactory)
|
||||||
assembler := reassembly.NewAssembler(streamPool)
|
assembler := reassembly.NewAssembler(streamPool)
|
||||||
|
assembler.AssemblerOptions = assemblerOptions
|
||||||
|
|
||||||
// Signal chan for system signals
|
// Signal chan for system signals
|
||||||
signalChan := make(chan os.Signal, 1)
|
signalChan := make(chan os.Signal, 1)
|
||||||
|
@ -346,7 +353,9 @@ func main() {
|
||||||
}
|
}
|
||||||
assembler.AssembleWithContext(packet.NetworkLayer().NetworkFlow(), tcp, &c)
|
assembler.AssembleWithContext(packet.NetworkLayer().NetworkFlow(), tcp, &c)
|
||||||
}
|
}
|
||||||
|
//ref := packet.Metadata().CaptureInfo.Timestamp
|
||||||
|
//flushed, closed := assembler.FlushWithOptions(reassembly.FlushOptions{T: ref.Add(time.Minute * 30), TC: ref.Add(time.Minute * 5)})
|
||||||
|
//Debug("Forced flush: %d flushed, %d closed (%s)", flushed, closed, ref)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue