-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
51 lines (41 loc) · 1.45 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package main
import (
"fmt"
"os"
nex "github.com/PretendoNetwork/nex-go"
"github.com/PretendoNetwork/nex-protocols-common-go/authentication"
)
var nexServer *nex.Server
func main() {
nexServer = nex.NewServer()
nexServer.SetPRUDPVersion(1)
nexServer.SetPRUDPProtocolMinorVersion(3)
nexServer.SetDefaultNEXVersion(&nex.NEXVersion{
Major: 3,
Minor: 8,
Patch: 13,
})
nexServer.SetKerberosPassword(os.Getenv("KERBEROS_PASSWORD"))
nexServer.SetAccessKey("844f1d0c")
nexServer.On("Data", func(packet *nex.PacketV1) {
request := packet.RMCRequest()
fmt.Println("==Pokémon Rumble World - Auth==")
fmt.Printf("Protocol ID: %#v\n", request.ProtocolID())
fmt.Printf("Method ID: %#v\n", request.MethodID())
fmt.Println("====================")
})
authenticationProtocol := authentication.NewCommonAuthenticationProtocol(nexServer)
secureStationURL := nex.NewStationURL("")
secureStationURL.SetScheme("prudps")
secureStationURL.SetAddress(os.Getenv("SECURE_SERVER_LOCATION"))
secureStationURL.SetPort(os.Getenv("SECURE_SERVER_PORT"))
secureStationURL.SetCID("1")
secureStationURL.SetPID("2")
secureStationURL.SetSID("1")
secureStationURL.SetStream("10")
secureStationURL.SetType("2")
authenticationProtocol.SetSecureStationURL(secureStationURL)
authenticationProtocol.SetBuildName("Pokémon Rumble World Auth")
nexServer.SetPasswordFromPIDFunction(passwordFromPID)
nexServer.Listen(":41960")
}