Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Mizu
Commits
be7c65eb
Commit
be7c65eb
authored
3 years ago
by
Roee Gadot
Browse files
Options
Download
Email Patches
Plain Diff
fix getStreamProps function.
(it should be passed from CLI as it was before).
parent
becb8d16
feat/extension-api-ngm
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tap/tcp_stream_factory.go
+8
-10
tap/tcp_stream_factory.go
with
8 additions
and
10 deletions
+8
-10
tap/tcp_stream_factory.go
+
8
-
10
View file @
be7c65eb
...
...
@@ -19,7 +19,7 @@ import (
*/
type
tcpStreamFactory
struct
{
wg
sync
.
WaitGroup
outboun
t
LinkWriter
*
OutboundLinkWriter
outboun
d
LinkWriter
*
OutboundLinkWriter
AllExtensionPorts
[]
string
Emitter
api
.
Emitter
}
...
...
@@ -36,9 +36,9 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
dstPort
:=
transport
.
Dst
()
.
String
()
// if factory.shouldNotifyOnOutboundLink(dstIp, dstPort) {
// factory.outboun
t
LinkWriter.WriteOutboundLink(net.Src().String(), dstIp, dstPort, "", "")
// factory.outboun
d
LinkWriter.WriteOutboundLink(net.Src().String(), dstIp, dstPort, "", "")
// }
props
:=
factory
.
getStreamProps
(
srcIp
,
dstIp
,
srcPort
,
dstPort
,
factory
.
AllExtensionPorts
)
props
:=
factory
.
getStreamProps
(
srcIp
,
dstIp
,
dstPort
)
isTapTarget
:=
props
.
isTapTarget
stream
:=
&
tcpStream
{
net
:
net
,
...
...
@@ -62,7 +62,7 @@ func (factory *tcpStreamFactory) New(net, transport gopacket.Flow, tcp *layers.T
parent
:
stream
,
isClient
:
true
,
isOutgoing
:
props
.
isOutgoing
,
outboundLinkWriter
:
factory
.
outboun
t
LinkWriter
,
outboundLinkWriter
:
factory
.
outboun
d
LinkWriter
,
Emitter
:
factory
.
Emitter
,
}
factory
.
wg
.
Add
(
1
)
...
...
@@ -76,17 +76,15 @@ func (factory *tcpStreamFactory) WaitGoRoutines() {
factory
.
wg
.
Wait
()
}
func
(
factory
*
tcpStreamFactory
)
getStreamProps
(
srcIP
string
,
dstIP
string
,
srcPort
string
,
dstPort
string
,
allExtensionPorts
[]
string
)
*
streamProps
{
func
(
factory
*
tcpStreamFactory
)
getStreamProps
(
srcIP
string
,
dstIP
string
,
dstPort
string
)
*
streamProps
{
if
hostMode
{
// TODO: Bring back `filterAuthorities`
return
&
streamProps
{
isTapTarget
:
true
,
isOutgoing
:
false
}
if
inArrayString
(
gSettings
.
filterAuthorities
,
fmt
.
Sprintf
(
"%s:%s"
,
dstIP
,
dstPort
))
==
true
{
if
inArrayString
(
gSettings
.
filterAuthorities
,
fmt
.
Sprintf
(
"%s:%s"
,
dstIP
,
dstPort
))
{
rlog
.
Debugf
(
"getStreamProps %s"
,
fmt
.
Sprintf
(
"+ host1 %s:%s"
,
dstIP
,
dstPort
))
return
&
streamProps
{
isTapTarget
:
true
,
isOutgoing
:
false
}
}
else
if
inArrayString
(
gSettings
.
filterAuthorities
,
dstIP
)
==
true
{
}
else
if
inArrayString
(
gSettings
.
filterAuthorities
,
dstIP
)
{
rlog
.
Debugf
(
"getStreamProps %s"
,
fmt
.
Sprintf
(
"+ host2 %s"
,
dstIP
))
return
&
streamProps
{
isTapTarget
:
true
,
isOutgoing
:
false
}
}
else
if
*
anydirection
&&
inArrayString
(
gSettings
.
filterAuthorities
,
srcIP
)
==
true
{
}
else
if
*
anydirection
&&
inArrayString
(
gSettings
.
filterAuthorities
,
srcIP
)
{
rlog
.
Debugf
(
"getStreamProps %s"
,
fmt
.
Sprintf
(
"+ host3 %s"
,
srcIP
))
return
&
streamProps
{
isTapTarget
:
true
,
isOutgoing
:
true
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help