Skip to content

Commit 5fa84ef

Browse files
committed
Handle forge FML protocol
1 parent 9d9f93c commit 5fa84ef

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

pkg/router.go

+5
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,13 @@ func (r Router) handleConnection(client net.Conn) {
117117
return
118118
}
119119
serverAddress := string(serverAddressRaw)
120+
121+
// Its common for proxies or mods to append extra data to the server address after a "///" separator. We ignore this for routing.
120122
serverAddress = strings.Split(serverAddress, "///")[0]
121123

124+
// Forge's "FML" protocol appends a marker to the end of the server address prefixed with a null character.
125+
serverAddress = strings.Split(serverAddress, "\x00")[0]
126+
122127
serverPortRaw := make([]byte, 2)
123128
_, err = packetReader.Read(serverPortRaw)
124129
if err != nil {

0 commit comments

Comments
 (0)