summaryrefslogtreecommitdiff
path: root/relay
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2025-04-07 15:55:04 +0200
committerSanto Cariotti <santo@dcariotti.me>2025-04-07 15:55:04 +0200
commitd35c26ecc61103b4ba7d484acf76b6a969159518 (patch)
treeb3dd927da75266f57311ab0ccf8dd6f4839e4c15 /relay
parent6d5824f7d2225bdb434becd4c5afa838aa2af440 (diff)
Start new play
Diffstat (limited to 'relay')
-rw-r--r--relay/relay.go4
-rw-r--r--relay/session.go2
2 files changed, 3 insertions, 3 deletions
diff --git a/relay/relay.go b/relay/relay.go
index b52a923..abd7d93 100644
--- a/relay/relay.go
+++ b/relay/relay.go
@@ -33,12 +33,12 @@ func (s *Server) RegisterName(ctx context.Context, in *pb.RelayRequest) (*pb.Rel
return nil, fmt.Errorf("IP address cannot be empty")
}
- sessionName := newSession()
+ sessionName := NewSession()
for {
if _, ok := table[name(sessionName)]; !ok {
break
}
- sessionName = newSession()
+ sessionName = NewSession()
}
table[name(sessionName)] = ips{ip0: in.Ip, ip1: ""}
diff --git a/relay/session.go b/relay/session.go
index 943c684..a2bc50e 100644
--- a/relay/session.go
+++ b/relay/session.go
@@ -16,7 +16,7 @@ var nouns = []string{
"crab", "cuckoo", "cymbal", "diplodocus", "donkey",
}
-func newSession() string {
+func NewSession() string {
noun := nouns[rand.Intn(len(nouns))]
adjective := adjectives[rand.Intn(len(adjectives))]
return noun + "-" + adjective