blob: d9451223fd6b752adb9e91e1a707ac60e2a37e2f (
plain) (
blame)
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
|
// 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)
}
|