mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-06 14:20:56 +00:00
Reformat, fix doc
This commit is contained in:
parent
50e295c834
commit
7be7fc5c3a
7 changed files with 23 additions and 24 deletions
|
@ -12,7 +12,6 @@ import (
|
||||||
|
|
||||||
"bitbucket.org/stendec/frankerfacez/socketserver/server"
|
"bitbucket.org/stendec/frankerfacez/socketserver/server"
|
||||||
"github.com/clarkduvall/hyperloglog"
|
"github.com/clarkduvall/hyperloglog"
|
||||||
"github.com/hashicorp/golang-lru"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type serverFilter struct {
|
type serverFilter struct {
|
||||||
|
|
|
@ -12,11 +12,10 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"sync"
|
cache "github.com/patrickmn/go-cache"
|
||||||
|
|
||||||
"github.com/pmylund/go-cache"
|
|
||||||
"golang.org/x/crypto/nacl/box"
|
"golang.org/x/crypto/nacl/box"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
"io"
|
"io"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// A RateLimit supports a constant number of Performed() calls every
|
// A RateLimit supports a constant number of Performed() calls every
|
||||||
|
@ -30,7 +30,7 @@ type timeRateLimit struct{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct a new RateLimit with the given count and duration.
|
// Construct a new RateLimit with the given count and duration.
|
||||||
func NewRateLimit(count int, period time.Duration) (RateLimit) {
|
func NewRateLimit(count int, period time.Duration) RateLimit {
|
||||||
return &timeRateLimit{
|
return &timeRateLimit{
|
||||||
count: count,
|
count: count,
|
||||||
period: period,
|
period: period,
|
||||||
|
@ -64,10 +64,11 @@ func (r *timeRateLimit) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
type unlimited struct{}
|
type unlimited struct{}
|
||||||
|
|
||||||
var unlimitedInstance unlimited
|
var unlimitedInstance unlimited
|
||||||
|
|
||||||
// Unlimited returns a RateLimit that never blocks. The Run() and Close() calls are no-ops.
|
// Unlimited returns a RateLimit that never blocks. The Run() and Close() calls are no-ops.
|
||||||
func Unlimited() (RateLimit) {
|
func Unlimited() RateLimit {
|
||||||
return unlimitedInstance
|
return unlimitedInstance
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package server
|
package server
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
var exampleData = []string{}
|
var exampleData = []string{}
|
||||||
|
|
|
@ -108,8 +108,7 @@ type ClientInfo struct {
|
||||||
// True if the client has already sent the 'ready' command
|
// True if the client has already sent the 'ready' command
|
||||||
ReadyComplete bool
|
ReadyComplete bool
|
||||||
|
|
||||||
// Server-initiated messages should be sent here
|
// Server-initiated messages should be sent via the Send() method
|
||||||
// This field will be nil before it is closed.
|
|
||||||
MessageChannel chan<- ClientMessage
|
MessageChannel chan<- ClientMessage
|
||||||
|
|
||||||
// Closed when the client is shutting down.
|
// Closed when the client is shutting down.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue