aboutsummaryrefslogtreecommitdiff
path: root/session.go
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-07-24 20:11:23 +0000
committerFuwn <[email protected]>2021-07-24 20:11:23 +0000
commit688aec1791ca5ba357cef5afc4a4c6e11d8ff4c2 (patch)
tree73104855103207b7d04f385c255b8d891bf4715e /session.go
downloadarchived-terra-688aec1791ca5ba357cef5afc4a4c6e11d8ff4c2.tar.xz
archived-terra-688aec1791ca5ba357cef5afc4a4c6e11d8ff4c2.zip
feat(global): push development state
Diffstat (limited to 'session.go')
-rw-r--r--session.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/session.go b/session.go
new file mode 100644
index 0000000..d945122
--- /dev/null
+++ b/session.go
@@ -0,0 +1,29 @@
+// Copyright (C) 2021-2021 The Whirlsplash Collective
+// SPDX-License-Identifier: GPL-3.0-only
+
+package terra
+
+import "github.com/Whirlsplash/terra/utilities"
+
+type Session struct {
+ Ip string
+ Port string
+ Username string
+ Password string
+ Avatar string
+ Properties SessionProperties
+}
+type SessionProperties struct {
+ SignalHandler bool
+}
+
+func (s Session) Connect() {
+ if s.Properties.SignalHandler {
+ utilities.SetupSignalHandler()
+ }
+
+ // The Distributor isn't actually needed for Terra to work, the only reason
+ // that we use it is because it gives us the correct Hub port to connect to.
+ hubPort := doDistributor(s.Ip, s.Port, s.Username, s.Password, s.Avatar)
+ doHub(s.Ip, hubPort, s.Username, s.Password)
+}