From 5374be1a0ff9a55c7bade339964c338116012e51 Mon Sep 17 00:00:00 2001 From: Zack Scholl Date: Tue, 13 Oct 2020 12:26:11 -0700 Subject: [PATCH] use dns to determine relay --- src/models/constants.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/models/constants.go b/src/models/constants.go index 6e3fd34d..283730b7 100644 --- a/src/models/constants.go +++ b/src/models/constants.go @@ -1,8 +1,22 @@ package models +import "net" + // TCP_BUFFER_SIZE is the maximum packet size const TCP_BUFFER_SIZE = 1024 * 64 // DEFAULT_RELAY is the default relay used (can be set using --relay) -const DEFAULT_RELAY = "142.93.177.120:9009" -const DEFAULT_RELAY6 = "[2604:a880:800:c1::14c:1]:9009" +var DEFAULT_RELAY = "croc.schollz.com" +var DEFAULT_RELAY6 = "croc6.schollz.com" +var DEFAULT_PORT = "9009" + +func init() { + iprecords, _ := net.LookupIP(DEFAULT_RELAY) + for _, ip := range iprecords { + DEFAULT_RELAY = ip.String() + ":" + DEFAULT_PORT + } + iprecords, _ = net.LookupIP(DEFAULT_RELAY6) + for _, ip := range iprecords { + DEFAULT_RELAY6 = "[" + ip.String() + "]:" + DEFAULT_PORT + } +}