mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-08-06 18:33:58 -05:00
30 lines
510 B
Go
30 lines
510 B
Go
package master
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"net"
|
|
)
|
|
|
|
type Session struct {
|
|
SessionID uint32
|
|
Challenge string
|
|
SecretKey string
|
|
IsConnected bool
|
|
}
|
|
|
|
func addSession(addr net.Addr, buffer []byte) {
|
|
sessionId := binary.BigEndian.Uint32(buffer[1:5])
|
|
|
|
mutex.Lock()
|
|
if _, ok := sessions[sessionId]; !ok {
|
|
sessions[sessionId] = &Session{
|
|
SessionID: sessionId,
|
|
Challenge: "",
|
|
// TODO: This is hardcoded for Mario Kart Wii
|
|
SecretKey: "9r3Rmy",
|
|
IsConnected: true,
|
|
}
|
|
}
|
|
mutex.Unlock()
|
|
}
|