diff options
Diffstat (limited to 'session.go')
| -rw-r--r-- | session.go | 29 |
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) +} |