1
1
Fork 0
mirror of https://github.com/schollz/croc.git synced 2025-10-11 05:11:06 +02:00

use dns to determine relay

This commit is contained in:
Zack Scholl 2020-10-13 12:26:11 -07:00
parent 1d874b5dbe
commit 5374be1a0f

View file

@ -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
}
}