mirror of
https://github.com/PretendoNetwork/wiiu-chat-secure.git
synced 2026-09-14 22:25:28 -05:00
Merge pull request #2 from hauntii/master
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func AddPlayerSession(pid uint32, urls []string, ip string, port string) {
|
||||
filter := bson.D{
|
||||
{"pid", pid},
|
||||
{"urls", urls},
|
||||
{"ip", ip},
|
||||
{"port", port},
|
||||
}
|
||||
|
||||
_, err := sessionsCollection.InsertOne(context.TODO(), filter)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@ var callsCollection *mongo.Collection
|
||||
var tourneysCollection *mongo.Collection
|
||||
|
||||
func connectMongo() {
|
||||
mongoClient, _ = mongo.NewClient(options.Client().ApplyURI(os.Getenv("MONGO_URI")))
|
||||
mongoClient, _ = mongo.NewClient(options.Client().ApplyURI(os.Getenv("PN_WIIU_CHAT_MONGO_URI")))
|
||||
mongoContext, _ = context.WithTimeout(context.Background(), 10*time.Second)
|
||||
_ = mongoClient.Connect(mongoContext)
|
||||
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func DeletePlayerSession(pid uint32) {
|
||||
filter := bson.D{
|
||||
{"pid", pid},
|
||||
}
|
||||
|
||||
_, err := sessionsCollection.DeleteOne(context.TODO(), filter)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
func DoesSessionExist(pid uint32) bool {
|
||||
var result bson.M
|
||||
filter := bson.D{
|
||||
{"pid", pid},
|
||||
}
|
||||
|
||||
err := sessionsCollection.FindOne(context.TODO(), filter, options.FindOne()).Decode(&result)
|
||||
if err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
return false
|
||||
} else {
|
||||
panic(err)
|
||||
}
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func GetAllSessionPIDs() []uint32 {
|
||||
var result []bson.M
|
||||
output := []uint32{}
|
||||
|
||||
c, _ := sessionsCollection.Find(context.TODO(), bson.D{})
|
||||
c.All(context.TODO(), &result)
|
||||
for _, i := range result {
|
||||
output = append(output, uint32(i["pid"].(int64)))
|
||||
}
|
||||
return output
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
func GetPlayerSessionAddress(pid uint32) string {
|
||||
var result bson.M
|
||||
filter := bson.D{
|
||||
{"pid", pid},
|
||||
}
|
||||
|
||||
fmt.Println(pid)
|
||||
|
||||
err := sessionsCollection.FindOne(context.TODO(), filter, options.FindOne()).Decode(&result)
|
||||
if err != nil {
|
||||
if err == mongo.ErrNoDocuments {
|
||||
return "127.0.0.1:9999"
|
||||
} else {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
return result["ip"].(string) + ":" + result["port"].(string)
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
func GetPlayerURLs(pid uint32) []string {
|
||||
var result bson.M
|
||||
filter := bson.D{
|
||||
{"pid", pid},
|
||||
}
|
||||
|
||||
err := sessionsCollection.FindOne(context.TODO(), filter, options.FindOne()).Decode(&result)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
oldurlArray := result["urls"].(bson.A)
|
||||
newurlArray := make([]string, len(oldurlArray))
|
||||
for i := 0; i < len(oldurlArray); i++ {
|
||||
newurlArray[i] = oldurlArray[i].(string)
|
||||
}
|
||||
|
||||
return newurlArray
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func UpdatePlayerSessionAll(pid uint32, urls []string, ip string, port string) {
|
||||
filter := bson.D{
|
||||
{"pid", pid},
|
||||
}
|
||||
|
||||
update := bson.D{
|
||||
{
|
||||
"$set", bson.D{
|
||||
{"pid", pid},
|
||||
{"urls", urls},
|
||||
{"ip", ip},
|
||||
{"port", port},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := sessionsCollection.UpdateOne(context.TODO(), filter, update)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
)
|
||||
|
||||
func UpdatePlayerSessionPort(pid uint32, port string) {
|
||||
filter := bson.D{
|
||||
{"pid", pid},
|
||||
}
|
||||
|
||||
update := bson.D{
|
||||
{
|
||||
"$set", bson.D{
|
||||
{"port", port},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err := sessionsCollection.UpdateOne(context.TODO(), filter, update)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
package database
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
)
|
||||
|
||||
func UpdatePlayerSessionUrl(pid uint32, oldurl string, newurl string) {
|
||||
var result bson.M
|
||||
filter := bson.D{
|
||||
{"pid", pid},
|
||||
}
|
||||
|
||||
err := sessionsCollection.FindOne(context.TODO(), filter, options.FindOne()).Decode(&result)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
oldurlArray := result["urls"].(bson.A)
|
||||
newurlArray := make([]string, len(oldurlArray))
|
||||
for i := 0; i < len(oldurlArray); i++ {
|
||||
if oldurlArray[i].(string) == oldurl {
|
||||
newurlArray[i] = newurl
|
||||
} else {
|
||||
newurlArray[i] = oldurlArray[i].(string)
|
||||
}
|
||||
}
|
||||
|
||||
update := bson.D{
|
||||
{
|
||||
"$set", bson.D{
|
||||
{"urls", newurlArray},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
_, err = sessionsCollection.UpdateOne(context.TODO(), filter, update)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,15 @@
|
||||
package globals
|
||||
|
||||
import (
|
||||
pb "github.com/PretendoNetwork/grpc-go/friends"
|
||||
"github.com/PretendoNetwork/nex-go"
|
||||
"github.com/PretendoNetwork/plogger-go"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
var Logger = plogger.NewLogger()
|
||||
var NEXServer *nex.Server
|
||||
var GRPCFriendsClientConnection *grpc.ClientConn
|
||||
var GRPCFriendsClient pb.FriendsClient
|
||||
var GRPCFriendsCommonMetadata metadata.MD
|
||||
|
||||
20
go.mod
20
go.mod
@@ -3,21 +3,24 @@ module github.com/PretendoNetwork/wiiu-chat-secure
|
||||
go 1.18
|
||||
|
||||
require (
|
||||
github.com/PretendoNetwork/nex-go v1.0.16
|
||||
github.com/PretendoNetwork/nex-protocols-common-go v1.0.17
|
||||
github.com/PretendoNetwork/nex-protocols-go v1.0.20
|
||||
github.com/PretendoNetwork/plogger-go v1.0.2
|
||||
github.com/PretendoNetwork/grpc-go v1.0.1
|
||||
github.com/PretendoNetwork/nex-go v1.0.28
|
||||
github.com/PretendoNetwork/nex-protocols-common-go v1.0.22
|
||||
github.com/PretendoNetwork/nex-protocols-go v1.0.38
|
||||
github.com/PretendoNetwork/plogger-go v1.0.3
|
||||
github.com/joho/godotenv v1.5.1
|
||||
go.mongodb.org/mongo-driver v1.11.4
|
||||
google.golang.org/grpc v1.48.0
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/fatih/color v1.15.0 // indirect
|
||||
github.com/golang/protobuf v1.5.2 // indirect
|
||||
github.com/golang/snappy v0.0.4 // indirect
|
||||
github.com/jwalton/go-supportscolor v1.1.0 // indirect
|
||||
github.com/klauspost/compress v1.16.4 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.18 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/montanaflynn/stats v0.7.0 // indirect
|
||||
github.com/pkg/errors v0.9.1 // indirect
|
||||
github.com/superwhiskers/crunch/v3 v3.5.7 // indirect
|
||||
@@ -26,8 +29,11 @@ require (
|
||||
github.com/xdg-go/stringprep v1.0.4 // indirect
|
||||
github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect
|
||||
golang.org/x/crypto v0.8.0 // indirect
|
||||
golang.org/x/net v0.9.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.7.0 // indirect
|
||||
golang.org/x/term v0.7.0 // indirect
|
||||
golang.org/x/sys v0.9.0 // indirect
|
||||
golang.org/x/term v0.9.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
)
|
||||
|
||||
149
go.sum
149
go.sum
@@ -1,21 +1,76 @@
|
||||
github.com/PretendoNetwork/nex-go v1.0.16 h1:g2lJW8G+WOS6/8qsgQ0+jLlzemjJ60tQtLqloLTjElo=
|
||||
github.com/PretendoNetwork/nex-go v1.0.16/go.mod h1:Bx2ONeSefnbJyE0IDIwGopxrjRrnszOV/uQv74Cx+m0=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
||||
github.com/PretendoNetwork/grpc-go v1.0.1 h1:3O0n4vnRX9rAZfrrjZydDjEOyWb4TbJcvwMrtY3Yz9g=
|
||||
github.com/PretendoNetwork/grpc-go v1.0.1/go.mod h1:XZjEsij9lL7HJBNkH6JPbBIkUSq/1rjflvjGdv+DAj0=
|
||||
github.com/PretendoNetwork/nex-go v1.0.26 h1:lJqDS5F8s836xcQzCEI5hNvUesmTsh2NGDC4tZvG250=
|
||||
github.com/PretendoNetwork/nex-go v1.0.26/go.mod h1:qzc5s4iNrt1ubS9Axb38b2jPuEsiETN2mDijn+MthmI=
|
||||
github.com/PretendoNetwork/nex-go v1.0.28 h1:g3892srP1T7LaeY5JklMtLZ03gTxE8wpXqpPQpXpN74=
|
||||
github.com/PretendoNetwork/nex-go v1.0.28/go.mod h1:tWfWhrC/DCJuS08jTk0ceOv2R1VtElvKSVv13To6miE=
|
||||
github.com/PretendoNetwork/nex-protocols-common-go v1.0.17 h1:w0n+RJAHANgX/iVnL5qRiyPJeDHcwr8w6DzDeFqxkqk=
|
||||
github.com/PretendoNetwork/nex-protocols-common-go v1.0.17/go.mod h1:5Y3jRIbvDxasj0CIvd024za+t9LMbD0OZkBwyKICijg=
|
||||
github.com/PretendoNetwork/nex-protocols-go v1.0.20 h1:vUoYHFvVWWx9Bm9/2JiN1siW03tFxtD4NY9w/WfC878=
|
||||
github.com/PretendoNetwork/nex-protocols-go v1.0.20/go.mod h1:Bt7hI7hJ+8r6UU5LSs+3xx4xzsvMVeEUkAW8Cg3lGjQ=
|
||||
github.com/PretendoNetwork/nex-protocols-common-go v1.0.22 h1:oIKx3AsBApaKWl1f91q/Vt59YKJOjoUhzxs/F0UA1Vw=
|
||||
github.com/PretendoNetwork/nex-protocols-common-go v1.0.22/go.mod h1:UwVHUdB1WFlzVn4yq8WLai0J+9OQXw4cg5qNjnJQ3RU=
|
||||
github.com/PretendoNetwork/nex-protocols-go v1.0.29 h1:sye/cpRHpDuoV1I+vpeTBIEXaKsJ5biK/+zo3O92dlY=
|
||||
github.com/PretendoNetwork/nex-protocols-go v1.0.29/go.mod h1:Pw1u2rsZGXuv45iM9y/7nZ5TBr1L5hctv9ylNXlW1ws=
|
||||
github.com/PretendoNetwork/nex-protocols-go v1.0.38 h1:DCzzlIx8NJlTLcfisqeVg4vXTKvIVe0kF1cXzDBz6p8=
|
||||
github.com/PretendoNetwork/nex-protocols-go v1.0.38/go.mod h1:jZSnoM2G4oc7tKXeUf2OkJ6VyfJc4nb7gR++2oNEh5A=
|
||||
github.com/PretendoNetwork/plogger-go v1.0.2 h1:vWKEnEmJJzYwqLxLyiSsAvCrZV6qnnu/a0GQOjIfzY0=
|
||||
github.com/PretendoNetwork/plogger-go v1.0.2/go.mod h1:7kD6M4vPq1JL4LTuPg6kuB1OvUBOwQOtAvTaUwMbwvU=
|
||||
github.com/PretendoNetwork/plogger-go v1.0.3 h1:KEnrUfPaCn0LFweg8OrhtiDhlN3pclWpNhlmAtmgfB0=
|
||||
github.com/PretendoNetwork/plogger-go v1.0.3/go.mod h1:7kD6M4vPq1JL4LTuPg6kuB1OvUBOwQOtAvTaUwMbwvU=
|
||||
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
||||
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
|
||||
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
|
||||
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
|
||||
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
|
||||
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
|
||||
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
|
||||
github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE=
|
||||
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
|
||||
github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
|
||||
github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
|
||||
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
|
||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
||||
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
|
||||
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
|
||||
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
|
||||
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
|
||||
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
|
||||
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
|
||||
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
|
||||
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
|
||||
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
|
||||
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
|
||||
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
|
||||
github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM=
|
||||
github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
|
||||
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
|
||||
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
|
||||
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.1.0 h1:HsXFJdMPjRUAx8cIW6g30hVSFYaxh9yRQwEWgkAR7lQ=
|
||||
@@ -31,8 +86,8 @@ github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
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=
|
||||
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
|
||||
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe/go.mod h1:wL8QJuTMNUDYhXwkmfOly8iTdp5TEcJFWZD2D7SIkUc=
|
||||
github.com/montanaflynn/stats v0.7.0 h1:r3y12KyNxj/Sb/iOE46ws+3mS1+MZca1wlHQFPsY/JU=
|
||||
github.com/montanaflynn/stats v0.7.0/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
|
||||
@@ -40,9 +95,13 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
|
||||
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/superwhiskers/crunch/v3 v3.5.7 h1:N9RLxaR65C36i26BUIpzPXGy2f6pQ7wisu2bawbKNqg=
|
||||
github.com/superwhiskers/crunch/v3 v3.5.7/go.mod h1:4ub2EKgF1MAhTjoOCTU4b9uLMsAweHEa89aRrfAypXA=
|
||||
github.com/tidwall/pretty v1.0.0 h1:HsD+QiTn7sK6flMKIvNmpqz1qrpP3Ps6jOKIKMooyg4=
|
||||
@@ -61,26 +120,50 @@ github.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a/go.mod h1:ul22v+Nro/
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.mongodb.org/mongo-driver v1.11.4 h1:4ayjakA013OdpGyL2K3ZqylTac/rMjrJOMZ1EHizXas=
|
||||
go.mongodb.org/mongo-driver v1.11.4/go.mod h1:PTSz5yu21bkT/wXpkS7WR5f0ddqw5quethTUn9WM+2g=
|
||||
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
|
||||
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
|
||||
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
@@ -88,13 +171,17 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
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.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
|
||||
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
|
||||
golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY=
|
||||
golang.org/x/term v0.8.0 h1:n5xxQn2i3PC0yLAbjTpNT85q/Kgzcr2gIoX9OrJUols=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.9.0 h1:GRRCnKYhdQrD8kfRAdQ6Zcw1P0OcELxGLKJvtjVMZ28=
|
||||
golang.org/x/term v0.9.0/go.mod h1:M6DEAAIenWoTxdKrOltXcmDY3rSplQUkrvaDU5FcQyo=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
@@ -103,13 +190,51 @@ golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
||||
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
|
||||
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
|
||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
||||
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
|
||||
google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w=
|
||||
google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
|
||||
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
|
||||
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
|
||||
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
|
||||
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
|
||||
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
|
||||
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
|
||||
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
|
||||
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
|
||||
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
||||
|
||||
53
grpc/send_friends_notification.go
Normal file
53
grpc/send_friends_notification.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package grpc
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
|
||||
pb "github.com/PretendoNetwork/grpc-go/friends"
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
friends_wiiu_types "github.com/PretendoNetwork/nex-protocols-go/friends-wiiu/types"
|
||||
nintendo_notifications "github.com/PretendoNetwork/nex-protocols-go/nintendo-notifications"
|
||||
nintendo_notifications_types "github.com/PretendoNetwork/nex-protocols-go/nintendo-notifications/types"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
func SendFriendsNotification(caller uint32, target uint32, ringing bool) {
|
||||
ctx := metadata.NewOutgoingContext(context.Background(), globals.GRPCFriendsCommonMetadata)
|
||||
|
||||
presence := friends_wiiu_types.NewNintendoPresenceV2()
|
||||
|
||||
presence.Online = true
|
||||
presence.GameKey = friends_wiiu_types.NewGameKey()
|
||||
presence.GameServerID = 0x1005A000
|
||||
presence.PID = 1 // This is not a PID, but the amount of times the PID is repeated in bytes in the application data.
|
||||
presence.GatheringID = caller
|
||||
|
||||
if ringing {
|
||||
presence.Unknown2 = 0x65
|
||||
}
|
||||
|
||||
targetBytes := make([]byte, 4)
|
||||
binary.BigEndian.PutUint32(targetBytes, target)
|
||||
|
||||
presence.ApplicationData = targetBytes
|
||||
|
||||
presence.GameKey.TitleID = 0x000500101005A100
|
||||
presence.GameKey.TitleVersion = 55
|
||||
|
||||
eventObject := nintendo_notifications_types.NewNintendoNotificationEvent()
|
||||
eventObject.Type = nintendo_notifications.NotificationTypes.FriendStartedTitle
|
||||
eventObject.SenderPID = caller
|
||||
eventObject.DataHolder = nex.NewDataHolder()
|
||||
eventObject.DataHolder.SetTypeName("NintendoPresenceV2")
|
||||
eventObject.DataHolder.SetObjectData(presence)
|
||||
|
||||
stream := nex.NewStreamOut(globals.NEXServer)
|
||||
eventObjectBytes := eventObject.Bytes(stream)
|
||||
|
||||
_, err := globals.GRPCFriendsClient.SendUserNotificationWiiU(ctx, &pb.SendUserNotificationWiiURequest{Pid: target, NotificationData: eventObjectBytes})
|
||||
if err != nil {
|
||||
globals.Logger.Criticalf("Greeting Friends gRPC failed! : %v", err)
|
||||
}
|
||||
}
|
||||
47
init.go
47
init.go
@@ -1,9 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
pb "github.com/PretendoNetwork/grpc-go/friends"
|
||||
"github.com/PretendoNetwork/plogger-go"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
"github.com/joho/godotenv"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/metadata"
|
||||
)
|
||||
|
||||
var logger = plogger.NewLogger()
|
||||
@@ -14,5 +24,42 @@ func init() {
|
||||
logger.Warning("Error loading .env file")
|
||||
}
|
||||
|
||||
friendsGRPCHost := os.Getenv("PN_WIIU_CHAT_FRIENDS_GRPC_HOST")
|
||||
friendsGRPCPort := os.Getenv("PN_WIIU_CHAT_FRIENDS_GRPC_PORT")
|
||||
friendsGRPCAPIKey := os.Getenv("PN_WIIU_CHAT_FRIENDS_GRPC_API_KEY")
|
||||
|
||||
if strings.TrimSpace(friendsGRPCHost) == "" {
|
||||
globals.Logger.Error("PN_WIIU_CHAT_FRIENDS_GRPC_HOST environment variable not set")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if strings.TrimSpace(friendsGRPCPort) == "" {
|
||||
globals.Logger.Error("PN_WIIU_CHAT_FRIENDS_GRPC_PORT environment variable not set")
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if port, err := strconv.Atoi(friendsGRPCPort); err != nil {
|
||||
globals.Logger.Errorf("PN_WIIU_CHAT_FRIENDS_GRPC_PORT is not a valid port. Expected 0-65535, got %s", friendsGRPCPort)
|
||||
os.Exit(0)
|
||||
} else if port < 0 || port > 65535 {
|
||||
globals.Logger.Errorf("PN_WIIU_CHAT_FRIENDS_GRPC_PORT is not a valid port. Expected 0-65535, got %s", friendsGRPCPort)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
if strings.TrimSpace(friendsGRPCAPIKey) == "" {
|
||||
globals.Logger.Warning("Insecure gRPC server detected. PN_WIIU_CHAT_FRIENDS_GRPC_API_KEY environment variable not set")
|
||||
}
|
||||
|
||||
globals.GRPCFriendsClientConnection, err = grpc.Dial(fmt.Sprintf("%s:%s", friendsGRPCHost, friendsGRPCPort), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
if err != nil {
|
||||
globals.Logger.Criticalf("Failed to connect to friends gRPC server: %v", err)
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
globals.GRPCFriendsClient = pb.NewFriendsClient(globals.GRPCFriendsClientConnection)
|
||||
globals.GRPCFriendsCommonMetadata = metadata.Pairs(
|
||||
"X-API-Key", friendsGRPCAPIKey,
|
||||
)
|
||||
|
||||
database.ConnectAll()
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package nex_match_making
|
||||
import (
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
match_making "github.com/PretendoNetwork/nex-protocols-go/match-making"
|
||||
match_making_types "github.com/PretendoNetwork/nex-protocols-go/match-making/types"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
@@ -11,7 +12,7 @@ func FindBySingleID(err error, client *nex.Client, callID uint32, id uint32) {
|
||||
|
||||
result := true
|
||||
|
||||
gathering := match_making.NewGathering()
|
||||
gathering := match_making_types.NewGathering()
|
||||
gathering.ID = id
|
||||
gathering.OwnerPID = caller
|
||||
gathering.HostPID = caller
|
||||
|
||||
@@ -12,7 +12,7 @@ func GetSessionUrls(err error, client *nex.Client, callID uint32, gid uint32) {
|
||||
|
||||
hostpid, _, _ := database.GetCallInfoByCaller(gid)
|
||||
|
||||
stationUrlStrings = database.GetPlayerURLs(hostpid)
|
||||
stationUrlStrings = globals.NEXServer.FindClientFromPID(hostpid).StationURLs()
|
||||
|
||||
rmcResponseStream := nex.NewStreamOut(globals.NEXServer)
|
||||
rmcResponseStream.WriteListString(stationUrlStrings)
|
||||
|
||||
@@ -6,11 +6,10 @@ import (
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
|
||||
match_making "github.com/PretendoNetwork/nex-protocols-go/match-making"
|
||||
matchmake_extension "github.com/PretendoNetwork/nex-protocols-go/matchmake-extension"
|
||||
)
|
||||
|
||||
func CreateMatchmakeSession(err error, client *nex.Client, callID uint32, matchmakeSession *match_making.MatchmakeSession, message string, participationCount uint16) {
|
||||
func CreateMatchmakeSession(err error, client *nex.Client, callID uint32, anyGathering *nex.DataHolder, message string, participationCount uint16) {
|
||||
var gid uint32 = client.PID() // TODO: Random this
|
||||
sessionKey := make([]byte, 32)
|
||||
//rand.Read(sessionKey)
|
||||
|
||||
@@ -1,36 +1,29 @@
|
||||
package nex_matchmake_extension
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
|
||||
matchmake_extension "github.com/PretendoNetwork/nex-protocols-go/matchmake-extension"
|
||||
"github.com/PretendoNetwork/nex-protocols-go/notifications"
|
||||
notifications_types "github.com/PretendoNetwork/nex-protocols-go/notifications/types"
|
||||
)
|
||||
|
||||
func GetFriendNotificationData(err error, client *nex.Client, callID uint32, uiType int32) {
|
||||
fmt.Println(client.PID()) // DEBUG
|
||||
|
||||
/*if !isUserAllowed(client.PID()) {
|
||||
globals.NEXServer.Kick(client)
|
||||
// get outta here
|
||||
}*/
|
||||
// pls stay, whitelist is gone
|
||||
|
||||
dataList := make([]*notifications.NotificationEvent, 0)
|
||||
dataList := make([]*notifications_types.NotificationEvent, 0)
|
||||
|
||||
caller, target, ringing := database.GetCallInfoByTarget(client.PID())
|
||||
|
||||
// TODO: Multiple calls. Wii U Chat can handle it, but we don't support it yet
|
||||
if (caller != 0) && (target == client.PID()) && ringing {
|
||||
if caller != 0 && target == client.PID() && ringing {
|
||||
// Being called
|
||||
notification := notifications.NewNotificationEvent()
|
||||
notificationType := notifications.BuildNotificationType(notifications.NotificationCategories.RequestJoinGathering, notifications.NotificationSubTypes.RequestJoinGathering.None)
|
||||
|
||||
notification := notifications_types.NewNotificationEvent()
|
||||
|
||||
notification.PIDSource = caller
|
||||
notification.Type = 101000
|
||||
notification.Type = notificationType
|
||||
notification.Param1 = caller
|
||||
notification.Param2 = target
|
||||
notification.StrParam = "Invite Request"
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package nex_matchmake_extension
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
matchmake_extension "github.com/PretendoNetwork/nex-protocols-go/matchmake-extension"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
@@ -10,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func JoinMatchmakeSessionEx(err error, client *nex.Client, callID uint32, gid uint32, strMessage string, dontCareMyBlockList bool, participationCount uint16) {
|
||||
fmt.Printf("gid: %d, strMessage: %s, dontCareMyBlockList: %t, participationCount: %d\r\n", gid, strMessage, dontCareMyBlockList, participationCount)
|
||||
globals.Logger.Infof("gid: %d, strMessage: %s, dontCareMyBlockList: %t, participationCount: %d\r\n", gid, strMessage, dontCareMyBlockList, participationCount)
|
||||
|
||||
database.EndCallRinging(gid)
|
||||
|
||||
|
||||
@@ -1,32 +1,46 @@
|
||||
package nex_matchmake_extension
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/grpc"
|
||||
nex_notifications "github.com/PretendoNetwork/wiiu-chat-secure/nex/notifications"
|
||||
|
||||
matchmake_extension "github.com/PretendoNetwork/nex-protocols-go/matchmake-extension"
|
||||
"github.com/PretendoNetwork/nex-protocols-go/notifications"
|
||||
)
|
||||
|
||||
func UpdateNotificationData(err error, client *nex.Client, callID uint32, uiType uint32, uiParam1 uint32, uiParam2 uint32, strParam string) {
|
||||
// TODO: Implement this
|
||||
fmt.Printf("uiType: %d, uiParam1: %d, uiParam2: %d, strParam: %s\r\n", uiType, uiParam1, uiParam2, strParam)
|
||||
globals.Logger.Infof("uiType: %d, uiParam1: %d, uiParam2: %d, strParam: %s\r\n", uiType, uiParam1, uiParam2, strParam)
|
||||
recipientClient := globals.NEXServer.FindClientFromPID(uiParam2)
|
||||
|
||||
// kick player if invite cancellation to prevent app hanging indefinitely
|
||||
if uiType == 102 {
|
||||
database.EndCall(uiParam1)
|
||||
globals.NEXServer.Kick(client)
|
||||
return
|
||||
if uiType == notifications.NotificationCategories.RequestJoinGathering {
|
||||
notificationType := notifications.BuildNotificationType(notifications.NotificationCategories.RequestJoinGathering, notifications.NotificationSubTypes.RequestJoinGathering.None)
|
||||
database.NewCall(client.PID(), uiParam2)
|
||||
|
||||
// If they don't have a session with the app, tell Friends to alert them on the HOME menu.
|
||||
if recipientClient != nil && recipientClient.StationURLs() != nil {
|
||||
nex_notifications.ProcessNotificationEvent(callID, client.PID(), notificationType, uiParam1, uiParam2, strParam)
|
||||
} else {
|
||||
grpc.SendFriendsNotification(client.PID(), uiParam2, true)
|
||||
}
|
||||
}
|
||||
|
||||
if uiType == 101 {
|
||||
database.NewCall(client.PID(), uiParam2)
|
||||
if database.DoesSessionExist(uiParam2) {
|
||||
nex_notifications.ProcessNotificationEvent(client.PID(), uiParam2, callID)
|
||||
if uiType == notifications.NotificationCategories.EndGathering {
|
||||
notificationType := notifications.BuildNotificationType(notifications.NotificationCategories.EndGathering, notifications.NotificationSubTypes.EndGathering.None)
|
||||
database.EndCall(uiParam1)
|
||||
|
||||
// Alert the other side we aren't calling anymore.
|
||||
|
||||
if recipientClient != nil && recipientClient.StationURLs() != nil {
|
||||
nex_notifications.ProcessNotificationEvent(callID, client.PID(), notificationType, uiParam1, uiParam2, strParam)
|
||||
} else {
|
||||
grpc.SendFriendsNotification(client.PID(), uiParam2, false)
|
||||
}
|
||||
|
||||
// The user must be kicked, otherwise the app hangs forever.
|
||||
globals.NEXServer.TimeoutKick(client)
|
||||
}
|
||||
|
||||
// Build response packet
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
package nex_nat_traversal
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
nat_traversal "github.com/PretendoNetwork/nex-protocols-go/nat-traversal"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
func ReportNATProperties(err error, client *nex.Client, callID uint32, natm uint32, natf uint32, rtt uint32) {
|
||||
stationUrlsStrings := database.GetPlayerURLs(client.PID())
|
||||
stationUrls := make([]nex.StationURL, len(stationUrlsStrings))
|
||||
pid := strconv.FormatUint(uint64(client.PID()), 10)
|
||||
rvcid := strconv.FormatUint(uint64(client.ConnectionID()), 10)
|
||||
|
||||
for i := 0; i < len(stationUrlsStrings); i++ {
|
||||
stationUrls[i] = *nex.NewStationURL(stationUrlsStrings[i])
|
||||
if stationUrls[i].Type() == "3" {
|
||||
natm_s := strconv.FormatUint(uint64(natm), 10)
|
||||
natf_s := strconv.FormatUint(uint64(natf), 10)
|
||||
stationUrls[i].SetNatm(natm_s)
|
||||
stationUrls[i].SetNatf(natf_s)
|
||||
}
|
||||
stationUrls[i].SetPID(pid)
|
||||
stationUrls[i].SetRVCID(rvcid)
|
||||
database.UpdatePlayerSessionUrl(client.PID(), stationUrlsStrings[i], stationUrls[i].EncodeToString())
|
||||
}
|
||||
|
||||
rmcResponse := nex.NewRMCResponse(nat_traversal.ProtocolID, callID)
|
||||
rmcResponse.SetSuccess(nat_traversal.MethodReportNATProperties, nil)
|
||||
|
||||
rmcResponseBytes := rmcResponse.Bytes()
|
||||
|
||||
responsePacket, _ := nex.NewPacketV1(client, nil)
|
||||
|
||||
responsePacket.SetVersion(1)
|
||||
responsePacket.SetSource(0xA1)
|
||||
responsePacket.SetDestination(0xAF)
|
||||
responsePacket.SetType(nex.DataPacket)
|
||||
responsePacket.SetPayload(rmcResponseBytes)
|
||||
|
||||
responsePacket.AddFlag(nex.FlagNeedsAck)
|
||||
responsePacket.AddFlag(nex.FlagReliable)
|
||||
|
||||
globals.NEXServer.Send(responsePacket)
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
package nex_nat_traversal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
nat_traversal "github.com/PretendoNetwork/nex-protocols-go/nat-traversal"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
func ReportNATTraversalResult(err error, client *nex.Client, callID uint32, cid uint32, result bool, rtt uint32) {
|
||||
fmt.Println("DID NAT TRAVERSAL SUCCEED?")
|
||||
fmt.Println(result)
|
||||
|
||||
rmcResponse := nex.NewRMCResponse(nat_traversal.ProtocolID, callID)
|
||||
rmcResponse.SetSuccess(nat_traversal.MethodReportNATTraversalResult, nil)
|
||||
|
||||
rmcResponseBytes := rmcResponse.Bytes()
|
||||
|
||||
responsePacket, _ := nex.NewPacketV1(client, nil)
|
||||
|
||||
responsePacket.SetVersion(1)
|
||||
responsePacket.SetSource(0xA1)
|
||||
responsePacket.SetDestination(0xAF)
|
||||
responsePacket.SetType(nex.DataPacket)
|
||||
responsePacket.SetPayload(rmcResponseBytes)
|
||||
|
||||
responsePacket.AddFlag(nex.FlagNeedsAck)
|
||||
responsePacket.AddFlag(nex.FlagReliable)
|
||||
|
||||
globals.NEXServer.Send(responsePacket)
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package nex_nat_traversal
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
nat_traversal "github.com/PretendoNetwork/nex-protocols-go/nat-traversal"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
func RequestProbeInitiationExt(err error, client *nex.Client, callID uint32, targetList []string, stationToProbe string) {
|
||||
fmt.Println(targetList)
|
||||
fmt.Println(stationToProbe)
|
||||
|
||||
rmcResponse := nex.NewRMCResponse(nat_traversal.ProtocolID, callID)
|
||||
rmcResponse.SetSuccess(nat_traversal.MethodRequestProbeInitiationExt, nil)
|
||||
|
||||
rmcResponseBytes := rmcResponse.Bytes()
|
||||
|
||||
responsePacket, _ := nex.NewPacketV1(client, nil)
|
||||
|
||||
responsePacket.SetVersion(1)
|
||||
responsePacket.SetSource(0xA1)
|
||||
responsePacket.SetDestination(0xAF)
|
||||
responsePacket.SetType(nex.DataPacket)
|
||||
responsePacket.SetPayload(rmcResponseBytes)
|
||||
|
||||
responsePacket.AddFlag(nex.FlagNeedsAck)
|
||||
responsePacket.AddFlag(nex.FlagReliable)
|
||||
|
||||
globals.NEXServer.Send(responsePacket)
|
||||
|
||||
// Send probe to other users
|
||||
|
||||
rmcRequestStream := nex.NewStreamOut(globals.NEXServer)
|
||||
|
||||
rmcRequestStream.WriteString(stationToProbe)
|
||||
|
||||
rmcRequestBody := rmcRequestStream.Bytes()
|
||||
|
||||
rmcRequest := nex.NewRMCRequest()
|
||||
rmcRequest.SetProtocolID(nat_traversal.ProtocolID)
|
||||
rmcRequest.SetCallID(3810693103)
|
||||
rmcRequest.SetMethodID(nat_traversal.MethodInitiateProbe)
|
||||
rmcRequest.SetParameters(rmcRequestBody)
|
||||
|
||||
rmcRequestBytes := rmcRequest.Bytes()
|
||||
|
||||
for _, target := range targetList {
|
||||
targetUrl := nex.NewStationURL(target)
|
||||
targetRVCID, _ := strconv.Atoi(targetUrl.RVCID())
|
||||
targetClient := globals.NEXServer.FindClientFromConnectionID(uint32(targetRVCID))
|
||||
fmt.Println(targetClient)
|
||||
if targetClient != nil {
|
||||
requestPacket, _ := nex.NewPacketV1(targetClient, nil)
|
||||
requestPacket.SetVersion(1)
|
||||
requestPacket.SetSource(0xA1)
|
||||
requestPacket.SetDestination(0xAF)
|
||||
requestPacket.SetType(nex.DataPacket)
|
||||
requestPacket.SetPayload(rmcRequestBytes)
|
||||
|
||||
requestPacket.AddFlag(nex.FlagNeedsAck)
|
||||
requestPacket.AddFlag(nex.FlagReliable)
|
||||
|
||||
globals.NEXServer.Send(requestPacket)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,26 +3,18 @@ package nex_notifications
|
||||
import (
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
"github.com/PretendoNetwork/nex-protocols-go/notifications"
|
||||
notifications_types "github.com/PretendoNetwork/nex-protocols-go/notifications/types"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
// * This technically is not the right way to format an RMC handler
|
||||
// * since it imples that the request format is "caller uint32, target uint32, callID uint32"
|
||||
// * when really the data we are sending in this function is the
|
||||
// * request format
|
||||
// *
|
||||
// * This is just a convenient way to handle sending notifications
|
||||
// * since the server never gets requests for this protocol
|
||||
// TODO - Maybe refactor this so that it's more in line with the spec?
|
||||
func ProcessNotificationEvent(callID uint32, pidSource uint32, uiType uint32, uiParam1 uint32, uiParam2 uint32, strParam string) {
|
||||
event := notifications_types.NewNotificationEvent()
|
||||
|
||||
func ProcessNotificationEvent(caller uint32, target uint32, callID uint32) {
|
||||
event := notifications.NewNotificationEvent()
|
||||
|
||||
event.PIDSource = caller // Sender PID
|
||||
event.Type = 101000 // Notification type
|
||||
event.Param1 = caller // Gathering ID
|
||||
event.Param2 = target // Recipient PID
|
||||
event.StrParam = "Invite Request" // Unknown
|
||||
event.PIDSource = pidSource // Sender PID
|
||||
event.Type = uiType // Notification type
|
||||
event.Param1 = uiParam1 // Gathering ID
|
||||
event.Param2 = uiParam2 // Recipient PID
|
||||
event.StrParam = strParam // Unknown
|
||||
|
||||
eventObject := nex.NewStreamOut(globals.NEXServer)
|
||||
eventObject.WriteStructure(event)
|
||||
@@ -35,7 +27,7 @@ func ProcessNotificationEvent(caller uint32, target uint32, callID uint32) {
|
||||
|
||||
rmcRequestBytes := rmcRequest.Bytes()
|
||||
|
||||
targetClient := globals.NEXServer.FindClientFromPID(uint32(target))
|
||||
targetClient := globals.NEXServer.FindClientFromPID(uiParam2)
|
||||
|
||||
requestPacket, _ := nex.NewPacketV1(targetClient, nil)
|
||||
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package nex
|
||||
|
||||
import (
|
||||
nat_traversal "github.com/PretendoNetwork/nex-protocols-common-go/nat-traversal"
|
||||
secureconnection "github.com/PretendoNetwork/nex-protocols-common-go/secure-connection"
|
||||
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
nex_secure_connection_common "github.com/PretendoNetwork/wiiu-chat-secure/nex/secure-connection/common"
|
||||
)
|
||||
|
||||
func registerCommonProtocols() {
|
||||
secureConnectionProtocol := secureconnection.NewCommonSecureConnectionProtocol(globals.NEXServer)
|
||||
|
||||
secureConnectionProtocol.AddConnection(nex_secure_connection_common.AddConnection) // * Stubbed
|
||||
secureConnectionProtocol.UpdateConnection(nex_secure_connection_common.UpdateConnection) // * Stubbed
|
||||
secureConnectionProtocol.DoesConnectionExist(nex_secure_connection_common.DoesConnectionExist) // * Stubbed
|
||||
nat_traversal.NewCommonNATTraversalProtocol(globals.NEXServer)
|
||||
secureconnection.NewCommonSecureConnectionProtocol(globals.NEXServer)
|
||||
}
|
||||
|
||||
@@ -4,21 +4,13 @@ import (
|
||||
match_making "github.com/PretendoNetwork/nex-protocols-go/match-making"
|
||||
match_making_ext "github.com/PretendoNetwork/nex-protocols-go/match-making-ext"
|
||||
matchmake_extension "github.com/PretendoNetwork/nex-protocols-go/matchmake-extension"
|
||||
nat_traversal "github.com/PretendoNetwork/nex-protocols-go/nat-traversal"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
nex_match_making "github.com/PretendoNetwork/wiiu-chat-secure/nex/match-making"
|
||||
nex_match_making_ext "github.com/PretendoNetwork/wiiu-chat-secure/nex/match-making-ext"
|
||||
nex_matchmake_extension "github.com/PretendoNetwork/wiiu-chat-secure/nex/matchmake-extension"
|
||||
nex_nat_traversal "github.com/PretendoNetwork/wiiu-chat-secure/nex/nat-traversal"
|
||||
)
|
||||
|
||||
func registerNEXProtocols() {
|
||||
natTraversalProtocol := nat_traversal.NewNATTraversalProtocol(globals.NEXServer)
|
||||
|
||||
natTraversalProtocol.ReportNATProperties(nex_nat_traversal.ReportNATProperties)
|
||||
natTraversalProtocol.RequestProbeInitiationExt(nex_nat_traversal.RequestProbeInitiationExt)
|
||||
natTraversalProtocol.ReportNATTraversalResult(nex_nat_traversal.ReportNATTraversalResult)
|
||||
|
||||
matchmakeExtensionProtocol := matchmake_extension.NewMatchmakeExtensionProtocol(globals.NEXServer)
|
||||
|
||||
matchmakeExtensionProtocol.OpenParticipation(nex_matchmake_extension.OpenParticipation)
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package nex_secure_connection_common
|
||||
|
||||
import (
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
func AddConnection(rvcid uint32, urls []string, ip, port string) {
|
||||
pid := globals.NEXServer.FindClientFromConnectionID(rvcid).PID()
|
||||
database.AddPlayerSession(pid, urls, ip, port)
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package nex_secure_connection_common
|
||||
|
||||
import (
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
func DoesConnectionExist(rvcid uint32) bool {
|
||||
pid := globals.NEXServer.FindClientFromConnectionID(rvcid).PID()
|
||||
return database.DoesSessionExist(pid)
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package nex_secure_connection_common
|
||||
|
||||
import (
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
func UpdateConnection(rvcid uint32, urls []string, ip, port string) {
|
||||
pid := globals.NEXServer.FindClientFromConnectionID(rvcid).PID()
|
||||
database.UpdatePlayerSessionAll(pid, urls, ip, port)
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import (
|
||||
"os"
|
||||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/database"
|
||||
_ "github.com/PretendoNetwork/nex-protocols-go"
|
||||
"github.com/PretendoNetwork/wiiu-chat-secure/globals"
|
||||
)
|
||||
|
||||
@@ -13,7 +13,7 @@ func StartNEXServer() {
|
||||
globals.NEXServer = nex.NewServer()
|
||||
globals.NEXServer.SetPRUDPVersion(1)
|
||||
globals.NEXServer.SetPRUDPProtocolMinorVersion(2)
|
||||
globals.NEXServer.SetKerberosPassword(os.Getenv("KERBEROS_PASSWORD"))
|
||||
globals.NEXServer.SetKerberosPassword(os.Getenv("PN_WIIU_CHAT_KERBEROS_PASSWORD"))
|
||||
globals.NEXServer.SetAccessKey("e7a47214")
|
||||
globals.NEXServer.SetDefaultNEXVersion(&nex.NEXVersion{
|
||||
Major: 3,
|
||||
@@ -31,16 +31,6 @@ func StartNEXServer() {
|
||||
fmt.Println("======================")
|
||||
})
|
||||
|
||||
globals.NEXServer.On("Kick", func(packet *nex.PacketV1) {
|
||||
fmt.Println("Kick client event called")
|
||||
database.DeletePlayerSession(packet.Sender().PID())
|
||||
})
|
||||
|
||||
globals.NEXServer.On("Disconnect", func(packet *nex.PacketV1) {
|
||||
fmt.Println("Disconnect client event called")
|
||||
database.DeletePlayerSession(packet.Sender().PID())
|
||||
})
|
||||
|
||||
// * Register the common handlers first so that they can be overridden if needed
|
||||
registerCommonProtocols()
|
||||
registerNEXProtocols()
|
||||
|
||||
Reference in New Issue
Block a user