mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 23:24:01 +03:00
Add timeattack detector
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -46,6 +47,10 @@ type EventStream interface {
|
||||
Shutdown()
|
||||
}
|
||||
|
||||
type TimeAttackDetector interface {
|
||||
Valid(time.Time) error
|
||||
}
|
||||
|
||||
type Logger interface {
|
||||
Named(name string) Logger
|
||||
|
||||
|
||||
+7
-6
@@ -17,12 +17,13 @@ type Proxy struct {
|
||||
streamWaitGroup sync.WaitGroup
|
||||
workerPool *ants.PoolWithFunc
|
||||
|
||||
secret Secret
|
||||
network Network
|
||||
antiReplayCache AntiReplayCache
|
||||
ipBlocklist IPBlocklist
|
||||
eventStream EventStream
|
||||
logger Logger
|
||||
secret Secret
|
||||
network Network
|
||||
timeAttackDetector TimeAttackDetector
|
||||
antiReplayCache AntiReplayCache
|
||||
ipBlocklist IPBlocklist
|
||||
eventStream EventStream
|
||||
logger Logger
|
||||
}
|
||||
|
||||
func (p *Proxy) ServeConn(conn net.Conn) {
|
||||
|
||||
@@ -3,12 +3,13 @@ package mtglib
|
||||
import "time"
|
||||
|
||||
type ProxyOpts struct {
|
||||
Secret Secret
|
||||
Network Network
|
||||
AntiReplayCache AntiReplayCache
|
||||
IPBlocklist IPBlocklist
|
||||
EventStream EventStream
|
||||
Logger Logger
|
||||
Secret Secret
|
||||
Network Network
|
||||
AntiReplayCache AntiReplayCache
|
||||
TimeAttackDetector TimeAttackDetector
|
||||
IPBlocklist IPBlocklist
|
||||
EventStream EventStream
|
||||
Logger Logger
|
||||
|
||||
BufferSize uint
|
||||
Concurrency uint
|
||||
|
||||
Reference in New Issue
Block a user