Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
58eca41c
Unverified
Commit
58eca41c
authored
Oct 19, 2023
by
Danyal Prout
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove space after comma
parent
0600fe87
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
backend.go
proxyd/backend.go
+1
-1
backend_test.go
proxyd/backend_test.go
+21
-0
No files found.
proxyd/backend.go
View file @
58eca41c
...
@@ -1170,6 +1170,6 @@ func RecordBatchRPCForward(ctx context.Context, backendName string, reqs []*RPCR
...
@@ -1170,6 +1170,6 @@ func RecordBatchRPCForward(ctx context.Context, backendName string, reqs []*RPCR
}
}
func
stripXFF
(
xff
string
)
string
{
func
stripXFF
(
xff
string
)
string
{
ipList
:=
strings
.
Split
(
xff
,
",
"
)
ipList
:=
strings
.
Split
(
xff
,
","
)
return
strings
.
TrimSpace
(
ipList
[
0
])
return
strings
.
TrimSpace
(
ipList
[
0
])
}
}
proxyd/backend_test.go
0 → 100644
View file @
58eca41c
package
proxyd
import
(
"github.com/stretchr/testify/assert"
"testing"
)
func
TestStripXFF
(
t
*
testing
.
T
)
{
tests
:=
[]
struct
{
in
,
out
string
}{
{
"1.2.3, 4.5.6, 7.8.9"
,
"1.2.3"
},
{
"1.2.3,4.5.6"
,
"1.2.3"
},
{
" 1.2.3 , 4.5.6 "
,
"1.2.3"
},
}
for
_
,
test
:=
range
tests
{
actual
:=
stripXFF
(
test
.
in
)
assert
.
Equal
(
t
,
test
.
out
,
actual
)
}
}
Write
Preview
Markdown
is supported
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