diff --git a/go.mod b/go.mod index d487c7c..311d5eb 100644 --- a/go.mod +++ b/go.mod @@ -1,35 +1,38 @@ module github.com/PretendoNetwork/mario-kart-7 -go 1.21 +go 1.22.7 + +toolchain go1.23.2 require ( github.com/PretendoNetwork/grpc-go v1.0.2 - github.com/PretendoNetwork/nex-go/v2 v2.0.1 - github.com/PretendoNetwork/nex-protocols-common-go/v2 v2.0.2 - github.com/PretendoNetwork/nex-protocols-go/v2 v2.0.1 + github.com/PretendoNetwork/nex-go/v2 v2.0.5 + github.com/PretendoNetwork/nex-protocols-common-go/v2 v2.0.7-0.20241116235837-ce1a92968ec9 + github.com/PretendoNetwork/nex-protocols-go/v2 v2.0.4 github.com/PretendoNetwork/plogger-go v1.0.4 github.com/joho/godotenv v1.5.1 github.com/lib/pq v1.10.9 - google.golang.org/grpc v1.63.0 + google.golang.org/grpc v1.68.0 ) require ( + github.com/PretendoNetwork/pq-extended v1.0.0 // indirect github.com/dolthub/maphash v0.1.0 // indirect - github.com/fatih/color v1.16.0 // indirect + github.com/fatih/color v1.18.0 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/jwalton/go-supportscolor v1.2.0 // indirect - github.com/klauspost/compress v1.17.7 // indirect - github.com/lxzan/gws v1.8.1 // indirect + github.com/klauspost/compress v1.17.11 // indirect + github.com/lxzan/gws v1.8.8 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/rasky/go-lzo v0.0.0-20200203143853-96a758eda86e // indirect github.com/superwhiskers/crunch/v3 v3.5.7 // indirect - golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect - golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/term v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect - google.golang.org/protobuf v1.33.0 // indirect + golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect + golang.org/x/mod v0.22.0 // indirect + golang.org/x/net v0.31.0 // indirect + golang.org/x/sys v0.27.0 // indirect + golang.org/x/term v0.26.0 // indirect + golang.org/x/text v0.20.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f // indirect + google.golang.org/protobuf v1.35.2 // indirect ) diff --git a/go.sum b/go.sum index 68f815f..8c9fa98 100644 --- a/go.sum +++ b/go.sum @@ -1,19 +1,21 @@ github.com/PretendoNetwork/grpc-go v1.0.2 h1:9TvKmX7dCOANyoHEra1MMYqS1N/RGav66TRG4SHInvo= github.com/PretendoNetwork/grpc-go v1.0.2/go.mod h1:XZjEsij9lL7HJBNkH6JPbBIkUSq/1rjflvjGdv+DAj0= -github.com/PretendoNetwork/nex-go/v2 v2.0.1 h1:7UEwulBtWD+HIbwB0uaRjBK1EXFLfSnv0t5+WyQYV0s= -github.com/PretendoNetwork/nex-go/v2 v2.0.1/go.mod h1:EZNyRVr0WpPLHZQqZZvarQ8/tXsEyVqLr6zy/hKCAV4= -github.com/PretendoNetwork/nex-protocols-common-go/v2 v2.0.2 h1:ZCSEA+jXE2eHF/uD/rrtugR0tlpdzmM6IVG8THlC4as= -github.com/PretendoNetwork/nex-protocols-common-go/v2 v2.0.2/go.mod h1:YEnnM1XDVGf34885MdHcRwZR/g9Qvjn3qkXlGlgiGPk= -github.com/PretendoNetwork/nex-protocols-go/v2 v2.0.1 h1:BqrHYF2JeYfB/JUmhU3pWR1qUJEEqUDM4pigXzi95Ik= -github.com/PretendoNetwork/nex-protocols-go/v2 v2.0.1/go.mod h1:TAzlc/gOu6E5Ct2NoTpN+Ea9Gpjh38dTsGqfs0pfZ4w= +github.com/PretendoNetwork/nex-go/v2 v2.0.5 h1:S/bYPb2SNUb9MSzai4wlqj/9J1JIiLuMtZcAAbBughM= +github.com/PretendoNetwork/nex-go/v2 v2.0.5/go.mod h1:iW1xjbg/vl2c3uheitUFxGcrt0sxaDxeXR5QqDcyLpI= +github.com/PretendoNetwork/nex-protocols-common-go/v2 v2.0.7-0.20241116235837-ce1a92968ec9 h1:XmCRWux+B4sVH+zzmONLzc7fR+4n+omSAfn/AV6G4Yc= +github.com/PretendoNetwork/nex-protocols-common-go/v2 v2.0.7-0.20241116235837-ce1a92968ec9/go.mod h1:Mngar0XMLs7oG9KfeyVJBBhYNCNRXxDcucJTthpP9GY= +github.com/PretendoNetwork/nex-protocols-go/v2 v2.0.4 h1:7Vb/jV/cO6c8XcGzGCoowSNXjZDLb/D1lYkLk8rxm7c= +github.com/PretendoNetwork/nex-protocols-go/v2 v2.0.4/go.mod h1:2UN8khoMDNaeJ4GcIG7ez7MqqmbLfLzbVS6hSa+kGnk= github.com/PretendoNetwork/plogger-go v1.0.4 h1:PF7xHw9eDRHH+RsAP9tmAE7fG0N0p6H4iPwHKnsoXwc= github.com/PretendoNetwork/plogger-go v1.0.4/go.mod h1:7kD6M4vPq1JL4LTuPg6kuB1OvUBOwQOtAvTaUwMbwvU= +github.com/PretendoNetwork/pq-extended v1.0.0 h1:GHZ0hLvCvmYKQPTV9I9XtTx8J1iB5Z9CEnfW2tUpsYg= +github.com/PretendoNetwork/pq-extended v1.0.0/go.mod h1:bq6Ai+3lG4/M0iamUBt2Uzi5vL/nYy1a1Ar2ow9NDF0= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dolthub/maphash v0.1.0 h1:bsQ7JsF4FkkWyrP3oCnFJgrCUAFbFf3kOl4L/QxPDyQ= github.com/dolthub/maphash v0.1.0/go.mod h1:gkg4Ch4CdCDu5h6PMriVLawB7koZ+5ijb9puGMV50a4= -github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= -github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= +github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU= github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= @@ -22,12 +24,12 @@ github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0= github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4= github.com/jwalton/go-supportscolor v1.2.0 h1:g6Ha4u7Vm3LIsQ5wmeBpS4gazu0UP1DRDE8y6bre4H8= github.com/jwalton/go-supportscolor v1.2.0/go.mod h1:hFVUAZV2cWg+WFFC4v8pT2X/S2qUUBYMioBD9AINXGs= -github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.11 h1:In6xLpyWOi1+C7tXUUWv2ot1QvBjxevKAaI6IXrJmUc= +github.com/klauspost/compress v1.17.11/go.mod h1:pMDklpSncoRMuLFrf1W9Ss9KT+0rH90U12bZKk7uwG0= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/lxzan/gws v1.8.1 h1:+Oc2f8U0YUE7mkBKUYUABvszUB9pfTfPQl7C26PW+LE= -github.com/lxzan/gws v1.8.1/go.mod h1:FcGeRMB7HwGuTvMLR24ku0Zx0p6RXqeKASeMc4VYgi4= +github.com/lxzan/gws v1.8.8 h1:st193ZG8qN8sSw8/g/UituFhs7etmKzS7jUqhijg5wM= +github.com/lxzan/gws v1.8.8/go.mod h1:FcGeRMB7HwGuTvMLR24ku0Zx0p6RXqeKASeMc4VYgi4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -41,28 +43,28 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/superwhiskers/crunch/v3 v3.5.7 h1:N9RLxaR65C36i26BUIpzPXGy2f6pQ7wisu2bawbKNqg= github.com/superwhiskers/crunch/v3 v3.5.7/go.mod h1:4ub2EKgF1MAhTjoOCTU4b9uLMsAweHEa89aRrfAypXA= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= -golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= -golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= -golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f h1:XdNn9LlyWAhLVp6P/i8QYBW+hlyhrhei9uErw2B5GJo= +golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f/go.mod h1:D5SMRVC3C2/4+F/DB1wZsLRnSNimn2Sp/NPsCrsv8ak= +golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= +golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= +golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= +golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= -golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= -google.golang.org/grpc v1.63.0 h1:WjKe+dnvABXyPJMD7KDNLxtoGk5tgk+YFWN6cBWjZE8= -google.golang.org/grpc v1.63.0/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= -google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= -google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= +golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= +golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= +golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f h1:C1QccEa9kUwvMgEUORqQD9S17QesQijxjZ84sO82mfo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241113202542-65e8d215514f/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI= +google.golang.org/grpc v1.68.0 h1:aHQeeJbo8zAkAa3pRzrVjZlbz6uSfeOXlJNQM0RAbz0= +google.golang.org/grpc v1.68.0/go.mod h1:fmSPC5AsjSBCK54MyHRx48kpOti1/jRfOlwEWywNjWA= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/nex/matchmake-extension/common/cleanup_search_matchmake_session.go b/nex/matchmake-extension/common/cleanup_search_matchmake_session.go index aada4b4..d6692d0 100644 --- a/nex/matchmake-extension/common/cleanup_search_matchmake_session.go +++ b/nex/matchmake-extension/common/cleanup_search_matchmake_session.go @@ -1,14 +1,9 @@ package nex_matchmake_extension_common import ( - "github.com/PretendoNetwork/nex-go/v2/types" - matchmaking_types "github.com/PretendoNetwork/nex-protocols-go/v2/match-making/types" + match_making_types "github.com/PretendoNetwork/nex-protocols-go/v2/match-making/types" ) -func CleanupSearchMatchmakeSession(matchmakeSession *matchmaking_types.MatchmakeSession) { - // Cleanup VR - matchmakeSession.Attributes.SetIndex(1, types.NewPrimitiveU32(0)) - - // Cleanup participation count - matchmakeSession.ParticipationCount.Value = 0 +func CleanupSearchMatchmakeSession(matchmakeSession *match_making_types.MatchmakeSession) { + // No changes needed } diff --git a/nex/register_common_secure_server_protocols.go b/nex/register_common_secure_server_protocols.go index 08c4e9d..0b41aa9 100644 --- a/nex/register_common_secure_server_protocols.go +++ b/nex/register_common_secure_server_protocols.go @@ -1,17 +1,19 @@ package nex import ( + "github.com/PretendoNetwork/mario-kart-7/database" "github.com/PretendoNetwork/mario-kart-7/globals" - matchmake_extension "github.com/PretendoNetwork/nex-protocols-go/v2/matchmake-extension" + common_globals "github.com/PretendoNetwork/nex-protocols-common-go/v2/globals" + common_match_making "github.com/PretendoNetwork/nex-protocols-common-go/v2/match-making" + common_match_making_ext "github.com/PretendoNetwork/nex-protocols-common-go/v2/match-making-ext" common_matchmake_extension "github.com/PretendoNetwork/nex-protocols-common-go/v2/matchmake-extension" + common_nat_traversal "github.com/PretendoNetwork/nex-protocols-common-go/v2/nat-traversal" + common_secure "github.com/PretendoNetwork/nex-protocols-common-go/v2/secure-connection" match_making "github.com/PretendoNetwork/nex-protocols-go/v2/match-making" - common_match_making "github.com/PretendoNetwork/nex-protocols-common-go/v2/match-making" match_making_ext "github.com/PretendoNetwork/nex-protocols-go/v2/match-making-ext" - common_match_making_ext "github.com/PretendoNetwork/nex-protocols-common-go/v2/match-making-ext" + matchmake_extension "github.com/PretendoNetwork/nex-protocols-go/v2/matchmake-extension" nat_traversal "github.com/PretendoNetwork/nex-protocols-go/v2/nat-traversal" - common_nat_traversal "github.com/PretendoNetwork/nex-protocols-common-go/v2/nat-traversal" secure "github.com/PretendoNetwork/nex-protocols-go/v2/secure-connection" - common_secure "github.com/PretendoNetwork/nex-protocols-common-go/v2/secure-connection" nex_matchmake_extension_common "github.com/PretendoNetwork/mario-kart-7/nex/matchmake-extension/common" ) @@ -25,17 +27,24 @@ func registerCommonSecureServerProtocols() { globals.SecureEndpoint.RegisterServiceProtocol(natTraversalProtocol) common_nat_traversal.NewCommonProtocol(natTraversalProtocol) + matchmakingManager := common_globals.NewMatchmakingManager(globals.SecureEndpoint, database.Postgres) + matchMakingProtocol := match_making.NewProtocol() globals.SecureEndpoint.RegisterServiceProtocol(matchMakingProtocol) - common_match_making.NewCommonProtocol(matchMakingProtocol) + commonMatchMakingProtocol := common_match_making.NewCommonProtocol(matchMakingProtocol) + commonMatchMakingProtocol.SetManager(matchmakingManager) matchMakingExtProtocol := match_making_ext.NewProtocol() globals.SecureEndpoint.RegisterServiceProtocol(matchMakingExtProtocol) - common_match_making_ext.NewCommonProtocol(matchMakingExtProtocol) + commonMatchMakingExtProtocol := common_match_making_ext.NewCommonProtocol(matchMakingExtProtocol) + commonMatchMakingExtProtocol.SetManager(matchmakingManager) matchmakeExtensionProtocol := matchmake_extension.NewProtocol() globals.SecureEndpoint.RegisterServiceProtocol(matchmakeExtensionProtocol) commonMatchmakeExtensionProtocol := common_matchmake_extension.NewCommonProtocol(matchmakeExtensionProtocol) + commonMatchmakeExtensionProtocol.SetManager(matchmakingManager) + // * Mario Kart 7 supports up to 8 communities per player + commonMatchmakeExtensionProtocol.PersistentGatheringCreationMax = 8 commonMatchmakeExtensionProtocol.CleanupSearchMatchmakeSession = nex_matchmake_extension_common.CleanupSearchMatchmakeSession } diff --git a/nex/secure.go b/nex/secure.go index 43b6704..282dc45 100644 --- a/nex/secure.go +++ b/nex/secure.go @@ -33,6 +33,10 @@ func StartSecureServer() { fmt.Println("====================") }) + globals.SecureEndpoint.OnError(func(err *nex.Error) { + globals.Logger.Error(err.Error()) + }) + registerCommonSecureServerProtocols() registerSecureServerNEXProtocols()