Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
qiuqunfeng
waf-console
Commits
f8f6b0d9
Commit
f8f6b0d9
authored
Feb 07, 2025
by
qiuqunfeng
Browse files
commit
parent
c5861eb6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
internal/service/service.go
internal/service/service.go
+3
-3
internal/service/waf.go
internal/service/waf.go
+2
-2
No files found.
internal/service/service.go
View file @
f8f6b0d9
...
@@ -4,8 +4,8 @@ import "context"
...
@@ -4,8 +4,8 @@ import "context"
type
Service
interface
{
type
Service
interface
{
// QueryIP(ip string) (*model.IPInfo, error)
// QueryIP(ip string) (*model.IPInfo, error)
GetWaf
(
ctx
context
.
Context
,
gatewayName
string
)
(
*
Waf
,
error
)
GetWaf
(
ctx
context
.
Context
,
gatewayName
string
)
(
*
Waf
Service
,
error
)
CreateWaf
(
ctx
context
.
Context
,
req
*
CreateWafReq
)
(
*
Waf
,
error
)
CreateWaf
(
ctx
context
.
Context
,
req
*
CreateWafReq
)
(
*
Waf
Service
,
error
)
UpdateMode
(
ctx
context
.
Context
,
req
*
UpdateModeReq
)
(
*
Waf
,
error
)
UpdateMode
(
ctx
context
.
Context
,
req
*
UpdateModeReq
)
(
*
Waf
Service
,
error
)
SaveRuleCategoryToDB
(
ctx
context
.
Context
)
error
SaveRuleCategoryToDB
(
ctx
context
.
Context
)
error
}
}
internal/service/waf.go
View file @
f8f6b0d9
...
@@ -48,7 +48,7 @@ func (s *wafService) GetWaf(ctx context.Context, gatewayName string) (*WafServic
...
@@ -48,7 +48,7 @@ func (s *wafService) GetWaf(ctx context.Context, gatewayName string) (*WafServic
},
nil
},
nil
}
}
func
(
s
*
wafService
)
CreateWaf
(
ctx
context
.
Context
,
req
*
CreateWafReq
)
(
*
Waf
,
error
)
{
func
(
s
*
wafService
)
CreateWaf
(
ctx
context
.
Context
,
req
*
CreateWafReq
)
(
*
Waf
Service
,
error
)
{
// Create the WAF service resource
// Create the WAF service resource
service
:=
&
v1alpha1
.
Service
{
service
:=
&
v1alpha1
.
Service
{
ObjectMeta
:
metav1
.
ObjectMeta
{
ObjectMeta
:
metav1
.
ObjectMeta
{
...
@@ -137,7 +137,7 @@ func (s *wafService) CreateWaf(ctx context.Context, req *CreateWafReq) (*Waf, er
...
@@ -137,7 +137,7 @@ func (s *wafService) CreateWaf(ctx context.Context, req *CreateWafReq) (*Waf, er
return
nil
,
nil
return
nil
,
nil
}
}
func
(
s
*
wafService
)
UpdateMode
(
ctx
context
.
Context
,
req
*
UpdateModeReq
)
(
*
Waf
,
error
)
{
func
(
s
*
wafService
)
UpdateMode
(
ctx
context
.
Context
,
req
*
UpdateModeReq
)
(
*
Waf
Service
,
error
)
{
// Check if WAF service exists
// Check if WAF service exists
wafService
:=
&
model
.
WafService
{}
wafService
:=
&
model
.
WafService
{}
err
:=
s
.
db
.
Model
(
&
model
.
WafService
{})
.
Where
(
"gateway_name = ?"
,
req
.
GatewayName
)
.
First
(
wafService
)
.
Error
err
:=
s
.
db
.
Model
(
&
model
.
WafService
{})
.
Where
(
"gateway_name = ?"
,
req
.
GatewayName
)
.
First
(
wafService
)
.
Error
...
...
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