Skip to content

Commit

Permalink
fix go lint
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Oct 30, 2023
1 parent 682ebf3 commit 87bdf2b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
14 changes: 5 additions & 9 deletions internal/outpost/rac/connection/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,13 @@ type MessageReader interface {

func (c *Connection) wsToGuacd() {
w := c.st.AcquireWriter()
var err error
defer c.onError(err)
for {
select {
default:
_, data, e := c.ws.ReadMessage()
if e != nil {
c.log.WithError(e).Trace("Error reading message from ws")
err = e
c.onError(e)
return
}

Expand All @@ -37,7 +35,7 @@ func (c *Connection) wsToGuacd() {

if _, e = w.Write(data); e != nil {
c.log.WithError(e).Trace("Failed writing to guacd")
err = e
c.onError(e)
return
}
case <-c.ctx.Done():
Expand All @@ -55,15 +53,13 @@ type MessageWriter interface {
func (c *Connection) guacdToWs() {
r := c.st.AcquireReader()
buf := bytes.NewBuffer(make([]byte, 0, guac.MaxGuacMessage*2))
var err error
defer c.onError(err)
for {
select {
default:
ins, e := r.ReadSome()
if e != nil {
c.log.WithError(e).Trace("Error reading from guacd")
err = e
c.onError(e)
return
}

Expand All @@ -74,7 +70,7 @@ func (c *Connection) guacdToWs() {

if _, e = buf.Write(ins); e != nil {
c.log.WithError(e).Trace("Failed to buffer guacd to ws")
err = e
c.onError(e)
return
}

Expand All @@ -85,7 +81,7 @@ func (c *Connection) guacdToWs() {
return
}
c.log.WithError(e).Trace("Failed sending message to ws")
err = e
c.onError(e)
return
}
buf.Reset()
Expand Down
4 changes: 2 additions & 2 deletions internal/outpost/rac/rac.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ func (rs *RACServer) wsHandler(ctx context.Context, args map[string]interface{})
cc.OnError = func(err error) {
rs.connm.Lock()
delete(rs.conns, wsm.ConnID)
rs.ac.SendWSHello(map[string]interface{}{
_ = rs.ac.SendWSHello(map[string]interface{}{
"active_connections": len(rs.conns),
})
rs.connm.Unlock()
}
rs.connm.Lock()
rs.conns[wsm.ConnID] = *cc
rs.ac.SendWSHello(map[string]interface{}{
_ = rs.ac.SendWSHello(map[string]interface{}{
"active_connections": len(rs.conns),
})
rs.connm.Unlock()
Expand Down
12 changes: 12 additions & 0 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 87bdf2b

Please sign in to comment.