feta/locator.go

37 lines
786 B
Go

package main
import (
"github.com/rs/zerolog/log"
"io/ioutil"
"net/http"
"time"
)
const mastodonIndexUrl = "https://instances.social/list.json?q%5Busers%5D=&q%5Bsearch%5D=&strict=false"
const pleromaIndexUrl = "https://distsn.org/cgi-bin/distsn-pleroma-instances-api.cgi"
type InstanceLocator struct {
pleromaIndexLastRefresh *time.Time
mastodonIndexLastRefresh *time.Time
instances map[string]Instance
}
func NewInstanceLocator() *InstanceLocator {
i := new(InstanceLocator)
return i
}
func (i *InstanceLocator) Locate() {
//var hostnames []string
var netClient = &http.Client{
Timeout: time.Second * 10,
}
resp, _ := netClient.Get(mastodonIndexUrl)
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
log.Debug().Msgf("%#v", body)
}