Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
user-discovery-bot
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
archives
user-discovery-bot
Commits
764306e4
Commit
764306e4
authored
Jan 12, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Add banned user list config to load on start
parent
01825dce
No related branches found
No related tags found
4 merge requests
!50
Revert "update deps"
,
!48
Release
,
!42
Add username field to users table for raw username
,
!41
Xx 3692/banned users
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
cmd/params.go
+12
-6
12 additions, 6 deletions
cmd/params.go
cmd/root.go
+11
-1
11 additions, 1 deletion
cmd/root.go
interfaces/params/general.go
+5
-4
5 additions, 4 deletions
interfaces/params/general.go
udb.yaml
+3
-1
3 additions, 1 deletion
udb.yaml
with
31 additions
and
12 deletions
cmd/params.go
+
12
−
6
View file @
764306e4
...
@@ -45,6 +45,11 @@ func InitParams(vip *viper.Viper) params.General {
...
@@ -45,6 +45,11 @@ func InitParams(vip *viper.Viper) params.General {
jww
.
FATAL
.
Fatalf
(
"Failed to read session path: %+v"
,
err
)
jww
.
FATAL
.
Fatalf
(
"Failed to read session path: %+v"
,
err
)
}
}
bannedUserList
,
err
:=
utils
.
ReadFile
(
viper
.
GetString
(
"bannedUserList"
))
if
err
!=
nil
{
jww
.
WARN
.
Printf
(
"Failed to read banned user list: %v"
,
err
)
}
// Only require proto user path if session does not exist
// Only require proto user path if session does not exist
var
protoUserJson
[]
byte
var
protoUserJson
[]
byte
protoUserPath
:=
""
protoUserPath
:=
""
...
@@ -105,5 +110,6 @@ func InitParams(vip *viper.Viper) params.General {
...
@@ -105,5 +110,6 @@ func InitParams(vip *viper.Viper) params.General {
IO
:
ioparams
,
IO
:
ioparams
,
Twilio
:
twilioparams
,
Twilio
:
twilioparams
,
ProtoUserJson
:
protoUserJson
,
ProtoUserJson
:
protoUserJson
,
BannedUserList
:
string
(
bannedUserList
),
}
}
}
}
This diff is collapsed.
Click to expand it.
cmd/root.go
+
11
−
1
View file @
764306e4
...
@@ -19,6 +19,7 @@ import (
...
@@ -19,6 +19,7 @@ import (
"gitlab.com/xx_network/primitives/ndf"
"gitlab.com/xx_network/primitives/ndf"
"gitlab.com/xx_network/primitives/utils"
"gitlab.com/xx_network/primitives/utils"
"os"
"os"
"strings"
"time"
"time"
)
)
...
@@ -42,7 +43,16 @@ var rootCmd = &cobra.Command{
...
@@ -42,7 +43,16 @@ var rootCmd = &cobra.Command{
initConfig
()
initConfig
()
initLog
()
initLog
()
p
:=
InitParams
(
viper
.
GetViper
())
p
:=
InitParams
(
viper
.
GetViper
())
storage
,
err
:=
storage
.
NewStorage
(
p
.
DbUsername
,
p
.
DbPassword
,
p
.
DbName
,
p
.
DbAddress
,
p
.
DbPort
)
bannedUsers
:=
make
(
map
[
string
]
struct
{})
if
p
.
BannedUserList
!=
""
{
bannedUserList
:=
strings
.
Split
(
p
.
BannedUserList
,
","
)
for
_
,
bannedUser
:=
range
bannedUserList
{
bannedUsers
[
bannedUser
]
=
struct
{}{}
}
}
storage
,
err
:=
storage
.
NewStorage
(
p
.
DbUsername
,
p
.
DbPassword
,
p
.
DbName
,
p
.
DbAddress
,
p
.
DbPort
,
bannedUsers
)
if
err
!=
nil
{
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"Failed to initialize storage interface: %+v"
,
err
)
jww
.
FATAL
.
Panicf
(
"Failed to initialize storage interface: %+v"
,
err
)
}
}
...
...
This diff is collapsed.
Click to expand it.
interfaces/params/general.go
+
5
−
4
View file @
764306e4
...
@@ -13,6 +13,7 @@ type General struct {
...
@@ -13,6 +13,7 @@ type General struct {
ProtoUserJson
[]
byte
ProtoUserJson
[]
byte
Ndf
string
Ndf
string
PermCert
[]
byte
PermCert
[]
byte
BannedUserList
string
Database
Database
IO
IO
...
...
This diff is collapsed.
Click to expand it.
udb.yaml
+
3
−
1
View file @
764306e4
...
@@ -10,3 +10,5 @@ dbUsername: ""
...
@@ -10,3 +10,5 @@ dbUsername: ""
dbPassword
:
"
"
dbPassword
:
"
"
dbName
:
"
"
dbName
:
"
"
dbAddress
:
"
"
dbAddress
:
"
"
bannedUserList
:
"
bannedUserList.csv"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment