Skip to content

Commit 7433efe

Browse files
committed
Move constants to a separate file
1 parent 8c38532 commit 7433efe

File tree

2 files changed

+30
-27
lines changed

2 files changed

+30
-27
lines changed

plugin/constants.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package plugin
2+
3+
const (
4+
DecodedQueryField string = "decodedQuery"
5+
DetectorField string = "detector"
6+
ScoreField string = "score"
7+
QueryField string = "query"
8+
ErrorField string = "error"
9+
IsInjectionField string = "is_injection"
10+
ResponseField string = "response"
11+
OutputsField string = "outputs"
12+
TokensField string = "tokens"
13+
StringField string = "String"
14+
ResponseTypeField string = "response_type"
15+
16+
DeepLearningModel string = "deep_learning_model"
17+
Libinjection string = "libinjection"
18+
19+
ResponseType string = "error"
20+
ErrorSeverity string = "EXCEPTION"
21+
ErrorNumber string = "42000"
22+
ErrorMessage string = "SQL injection detected"
23+
ErrorDetail string = "Back off, you're not welcome here."
24+
LogLevel string = "error"
25+
26+
TokenizeAndSequencePath string = "/tokenize_and_sequence"
27+
PredictPath string = "/v1/models/%s/versions/%s:predict"
28+
)

plugin/plugin.go

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -20,36 +20,10 @@ import (
2020
"google.golang.org/grpc"
2121
)
2222

23-
const (
24-
DecodedQueryField string = "decodedQuery"
25-
DetectorField string = "detector"
26-
ScoreField string = "score"
27-
QueryField string = "query"
28-
ErrorField string = "error"
29-
IsInjectionField string = "is_injection"
30-
ResponseField string = "response"
31-
OutputsField string = "outputs"
32-
TokensField string = "tokens"
33-
StringField string = "String"
34-
ResponseTypeField string = "response_type"
35-
36-
DeepLearningModel string = "deep_learning_model"
37-
Libinjection string = "libinjection"
38-
39-
ResponseType string = "error"
40-
ErrorSeverity string = "EXCEPTION"
41-
ErrorNumber string = "42000"
42-
ErrorMessage string = "SQL injection detected"
43-
ErrorDetail string = "Back off, you're not welcome here."
44-
LogLevel string = "error"
45-
46-
TokenizeAndSequencePath string = "/tokenize_and_sequence"
47-
PredictPath string = "/v1/models/%s/versions/%s:predict"
48-
)
49-
5023
type Plugin struct {
5124
goplugin.GRPCPlugin
5225
v1.GatewayDPluginServiceServer
26+
5327
Logger hclog.Logger
5428
Threshold float32
5529
EnableLibinjection bool
@@ -68,6 +42,7 @@ type Plugin struct {
6842

6943
type InjectionDetectionPlugin struct {
7044
goplugin.NetRPCUnsupportedPlugin
45+
7146
Impl Plugin
7247
}
7348

0 commit comments

Comments
 (0)