Skip to content

Commit

Permalink
Bump deps and fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
ChillerDragon committed Jun 21, 2024
1 parent 91a63c8 commit 26bfbfb
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
7 changes: 4 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ module github.com/teeworlds-go/proxy

go 1.22.3

require github.com/teeworlds-go/teeworlds v0.0.0-20240621015046-db550ce86fda

require github.com/teeworlds-go/huffman v1.0.0 // indirect
require (
github.com/teeworlds-go/huffman v1.0.0 // indirect
github.com/teeworlds-go/teeworlds v0.0.0-20240621024049-4f37d5de48ca // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
github.com/teeworlds-go/huffman v1.0.0 h1:XSNMNAJZb+njNrPACsxcDrrLDXTGjZZt35FqLAuHi4I=
github.com/teeworlds-go/huffman v1.0.0/go.mod h1:kjaXpL6C6xL7CM+tWPNYjdEgVZB2GumKhx7rCDdXArU=
github.com/teeworlds-go/teeworlds v0.0.0-20240621015046-db550ce86fda h1:Ho08Zo5Co+t5VfX4wVqiEDHxxDD3F+52AYne/Gs7oj0=
github.com/teeworlds-go/teeworlds v0.0.0-20240621015046-db550ce86fda/go.mod h1:aKhyLQAZ0cXv3e6ivNMiolKLbycQlDTIq9Yldn7klWM=
github.com/teeworlds-go/teeworlds v0.0.0-20240621024049-4f37d5de48ca h1:0u/k7xwegit84TXXBnS7iLJSxUxuE2AjOX/aJwlRIH0=
github.com/teeworlds-go/teeworlds v0.0.0-20240621024049-4f37d5de48ca/go.mod h1:aKhyLQAZ0cXv3e6ivNMiolKLbycQlDTIq9Yldn7klWM=
28 changes: 15 additions & 13 deletions proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,19 +93,21 @@ func RunConnection(conn *Connection, twconn *protocol7.Connection) {
if err != nil {
panic(err)
}
// example of inspecting incoming trafic
for i, msg := range result.Packet.Messages {
if msg.MsgId() == network7.MsgGameSvChat {
var chat *messages7.SvChat
var ok bool
if chat, ok = result.Packet.Messages[i].(*messages7.SvChat); ok {
fmt.Printf("got chat msg: %s\n", chat.Message)
chat.Message = "capitalism."

// modify chat if this was a proxy
result.Packet.Messages[i] = chat

srvMsg = result.Packet.Pack(twconn)
// inspecting incoming trafic
if result != nil && result.Packet != nil {
for i, msg := range result.Packet.Messages {
if msg.MsgId() == network7.MsgGameSvChat {
var chat *messages7.SvChat
var ok bool
if chat, ok = result.Packet.Messages[i].(*messages7.SvChat); ok {
fmt.Printf("got chat msg: %s\n", chat.Message)
chat.Message = "capitalism."

// modify chat if this was a proxy
result.Packet.Messages[i] = chat

srvMsg = result.Packet.Pack(twconn)
}
}
}
}
Expand Down

0 comments on commit 26bfbfb

Please sign in to comment.