mirror of
https://github.com/onyx-and-iris/q3rcon-proxy.git
synced 2026-02-16 08:47:49 +00:00
enable godot, misspell linters
This commit is contained in:
parent
f6ea67b88c
commit
fc6ac8fa4e
5
.gitignore
vendored
5
.gitignore
vendored
@ -25,4 +25,7 @@ go.work
|
|||||||
# End of gignore: github.com/onyx-and-iris/gignore
|
# End of gignore: github.com/onyx-and-iris/gignore
|
||||||
|
|
||||||
# Added by goreleaser init:
|
# Added by goreleaser init:
|
||||||
dist/
|
dist/
|
||||||
|
|
||||||
|
# env files
|
||||||
|
.envrc
|
||||||
@ -6,7 +6,7 @@ run:
|
|||||||
go: '1.24'
|
go: '1.24'
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable: [errcheck, godot, misspell]
|
disable: [errcheck]
|
||||||
enable:
|
enable:
|
||||||
# Default enabled linters
|
# Default enabled linters
|
||||||
- errcheck # Check for unchecked errors
|
- errcheck # Check for unchecked errors
|
||||||
|
|||||||
@ -114,7 +114,7 @@ func main() {
|
|||||||
log.Fatal(cmd.Run(context.Background(), os.Args))
|
log.Fatal(cmd.Run(context.Background(), os.Args))
|
||||||
}
|
}
|
||||||
|
|
||||||
// launchProxy initializes the UDP proxy server with the given configuration.
|
// launchProxy initialises the UDP proxy server with the given configuration.
|
||||||
// It listens on the specified proxy host and port, and forwards traffic to the target host and port.
|
// It listens on the specified proxy host and port, and forwards traffic to the target host and port.
|
||||||
// server.ListenAndServe blocks until the server is stopped or an error occurs.
|
// server.ListenAndServe blocks until the server is stopped or an error occurs.
|
||||||
func launchProxy(cfg proxyConfig, errChan chan<- error) {
|
func launchProxy(cfg proxyConfig, errChan chan<- error) {
|
||||||
@ -131,7 +131,7 @@ func launchProxy(cfg proxyConfig, errChan chan<- error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("q3rcon-proxy initialized: [proxy] (%s) [target] (%s)", hostAddr, proxyAddr)
|
log.Printf("q3rcon-proxy initialised: [proxy] (%s) [target] (%s)", hostAddr, proxyAddr)
|
||||||
|
|
||||||
errChan <- server.ListenAndServe()
|
errChan <- server.ListenAndServe()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import (
|
|||||||
// Option is a functional option type that allows us to configure the Client.
|
// Option is a functional option type that allows us to configure the Client.
|
||||||
type Option func(*Client)
|
type Option func(*Client)
|
||||||
|
|
||||||
// WithSessionTimeout is a functional option to set the session timeout
|
// WithSessionTimeout is a functional option to set the session timeout.
|
||||||
func WithSessionTimeout(timeout time.Duration) Option {
|
func WithSessionTimeout(timeout time.Duration) Option {
|
||||||
return func(c *Client) {
|
return func(c *Client) {
|
||||||
if timeout < time.Minute {
|
if timeout < time.Minute {
|
||||||
|
|||||||
@ -2,7 +2,7 @@ package udpproxy
|
|||||||
|
|
||||||
import "sync"
|
import "sync"
|
||||||
|
|
||||||
// sessionCache tracks connection sessions
|
// sessionCache tracks connection sessions.
|
||||||
type sessionCache struct {
|
type sessionCache struct {
|
||||||
mu sync.RWMutex
|
mu sync.RWMutex
|
||||||
data map[string]*session
|
data map[string]*session
|
||||||
@ -15,7 +15,7 @@ func newSessionCache() sessionCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// read returns the associated session for an addr
|
// read returns the associated session for an addr.
|
||||||
func (sc *sessionCache) read(addr string) (*session, bool) {
|
func (sc *sessionCache) read(addr string) (*session, bool) {
|
||||||
sc.mu.RLock()
|
sc.mu.RLock()
|
||||||
defer sc.mu.RUnlock()
|
defer sc.mu.RUnlock()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user