-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update to latest library versions
- Loading branch information
1 parent
e3ed1da
commit 661568b
Showing
13 changed files
with
318 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package database | ||
|
||
import ( | ||
"database/sql" | ||
"os" | ||
|
||
_ "github.com/lib/pq" | ||
|
||
"github.com/PretendoNetwork/ironfall-invasion/globals" | ||
) | ||
|
||
var Postgres *sql.DB | ||
|
||
func ConnectPostgres() { | ||
var err error | ||
|
||
Postgres, err = sql.Open("postgres", os.Getenv("PN_IRONFALL_POSTGRES_URI")) | ||
if err != nil { | ||
globals.Logger.Critical(err.Error()) | ||
} | ||
|
||
globals.Logger.Success("Connected to Postgres!") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package globals | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/PretendoNetwork/nex-go/v2" | ||
"github.com/PretendoNetwork/nex-go/v2/types" | ||
) | ||
|
||
var AuthenticationServerAccount *nex.Account | ||
var SecureServerAccount *nex.Account | ||
|
||
func AccountDetailsByPID(pid types.PID) (*nex.Account, *nex.Error) { | ||
if pid.Equals(AuthenticationServerAccount.PID) { | ||
return AuthenticationServerAccount, nil | ||
} | ||
|
||
if pid.Equals(SecureServerAccount.PID) { | ||
return SecureServerAccount, nil | ||
} | ||
|
||
password, errorCode := PasswordFromPID(pid) | ||
if errorCode != 0 { | ||
return nil, nex.NewError(errorCode, "Failed to get password from PID") | ||
} | ||
|
||
account := nex.NewAccount(pid, strconv.Itoa(int(pid)), password) | ||
|
||
return account, nil | ||
} | ||
|
||
func AccountDetailsByUsername(username string) (*nex.Account, *nex.Error) { | ||
if username == AuthenticationServerAccount.Username { | ||
return AuthenticationServerAccount, nil | ||
} | ||
|
||
if username == SecureServerAccount.Username { | ||
return SecureServerAccount, nil | ||
} | ||
|
||
pidInt, err := strconv.Atoi(username) | ||
if err != nil { | ||
return nil, nex.NewError(nex.ResultCodes.RendezVous.InvalidUsername, "Invalid username") | ||
} | ||
|
||
pid := types.NewPID(uint64(pidInt)) | ||
|
||
password, errorCode := PasswordFromPID(pid) | ||
if errorCode != 0 { | ||
return nil, nex.NewError(errorCode, "Failed to get password from PID") | ||
} | ||
|
||
account := nex.NewAccount(pid, username, password) | ||
|
||
return account, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,38 @@ | ||
module github.com/PretendoNetwork/ironfall-invasion | ||
|
||
go 1.19 | ||
go 1.22.1 | ||
|
||
toolchain go1.23.5 | ||
|
||
require ( | ||
github.com/PretendoNetwork/grpc-go v1.0.2 | ||
github.com/PretendoNetwork/nex-go v1.0.41 | ||
github.com/PretendoNetwork/nex-protocols-common-go v1.0.29 | ||
github.com/PretendoNetwork/nex-protocols-go v1.0.55 | ||
github.com/PretendoNetwork/nex-go/v2 v2.1.1 | ||
github.com/PretendoNetwork/nex-protocols-common-go/v2 v2.2.1 | ||
github.com/PretendoNetwork/nex-protocols-go/v2 v2.2.0 | ||
github.com/PretendoNetwork/plogger-go v1.0.4 | ||
github.com/joho/godotenv v1.5.1 | ||
google.golang.org/grpc v1.59.0 | ||
github.com/lib/pq v1.10.9 | ||
google.golang.org/grpc v1.70.0 | ||
) | ||
|
||
require ( | ||
github.com/fatih/color v1.15.0 // indirect | ||
github.com/golang/protobuf v1.5.3 // indirect | ||
github.com/PretendoNetwork/pq-extended v1.0.0 // indirect | ||
github.com/dolthub/maphash v0.1.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/mattn/go-colorable v0.1.13 // indirect | ||
github.com/klauspost/compress v1.17.11 // indirect | ||
github.com/lxzan/gws v1.8.8 // indirect | ||
github.com/mattn/go-colorable v0.1.14 // 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-20231006140011-7918f672742d // indirect | ||
golang.org/x/mod v0.13.0 // indirect | ||
golang.org/x/net v0.17.0 // indirect | ||
golang.org/x/sys v0.13.0 // indirect | ||
golang.org/x/term v0.13.0 // indirect | ||
golang.org/x/text v0.13.0 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231016165738-49dd2c1f3d0b // indirect | ||
google.golang.org/protobuf v1.31.0 // indirect | ||
golang.org/x/exp v0.0.0-20250210185358-939b2ce775ac // indirect | ||
golang.org/x/mod v0.23.0 // indirect | ||
golang.org/x/net v0.35.0 // indirect | ||
golang.org/x/sys v0.30.0 // indirect | ||
golang.org/x/term v0.29.0 // indirect | ||
golang.org/x/text v0.22.0 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20250207221924-e9438ea467c6 // indirect | ||
google.golang.org/protobuf v1.36.5 // indirect | ||
) |
Oops, something went wrong.