|
|
@@ -76,6 +76,8 @@ type AntiReplayCache interface {
|
|
76
|
76
|
// a worker pool, so in worst cases you can expect that you invoke this
|
|
77
|
77
|
// object more frequent than defined proxy concurrency.
|
|
78
|
78
|
type IPBlocklist interface {
|
|
|
79
|
+ // Contains checks if given IP address belongs to this blocklist If.
|
|
|
80
|
+ // it is, a connection is terminated .
|
|
79
|
81
|
Contains(net.IP) bool
|
|
80
|
82
|
}
|
|
81
|
83
|
|
|
|
@@ -107,6 +109,26 @@ type TimeAttackDetector interface {
|
|
107
|
109
|
Valid(time.Time) error
|
|
108
|
110
|
}
|
|
109
|
111
|
|
|
|
112
|
+// Logger defines an interface of the logger used by mtglib.
|
|
|
113
|
+//
|
|
|
114
|
+// Each logger has a name. It is possible to stack names to organize
|
|
|
115
|
+// poor-man namespaces. Also, each logger must be able to bind
|
|
|
116
|
+// parameters to avoid pushing them all the time.
|
|
|
117
|
+//
|
|
|
118
|
+// Example
|
|
|
119
|
+//
|
|
|
120
|
+// logger := SomeLogger{}
|
|
|
121
|
+// logger = logger.BindStr("ip", net.IP{127, 0, 0, 1})
|
|
|
122
|
+// logger.Info("Hello")
|
|
|
123
|
+//
|
|
|
124
|
+// In that case, ip is bound as a parameter. It is a great idea to
|
|
|
125
|
+// put this parameter somewhere in a log message.
|
|
|
126
|
+//
|
|
|
127
|
+// logger1 = logger.BindStr("param1", "11")
|
|
|
128
|
+// logger2 = logger.BindInt("param2", 11)
|
|
|
129
|
+//
|
|
|
130
|
+// logger1 should see no param2 and vice versa, logger2 should not see param1
|
|
|
131
|
+// If you attach a parameter to a logger, parents should not know about that.
|
|
110
|
132
|
type Logger interface {
|
|
111
|
133
|
Named(name string) Logger
|
|
112
|
134
|
|