mirror of
https://github.com/onyx-and-iris/q3rcon-proxy.git
synced 2025-05-16 17:10:25 +01:00
23 lines
508 B
Go
23 lines
508 B
Go
package udpproxy
|
|
|
|
import (
|
|
"time"
|
|
|
|
log "github.com/sirupsen/logrus"
|
|
)
|
|
|
|
// Option is a functional option type that allows us to configure the Client.
|
|
type Option func(*Client)
|
|
|
|
// WithSessionTimeout is a functional option to set the session timeout
|
|
func WithSessionTimeout(timeout time.Duration) Option {
|
|
return func(c *Client) {
|
|
if timeout < time.Minute {
|
|
log.Warnf("cannot set stale session timeout to less than 1 minute.. defaulting to 20 minutes")
|
|
return
|
|
}
|
|
|
|
c.sessionTimeout = timeout
|
|
}
|
|
}
|