Commit 2b8153b7 authored by Lukas Matt's avatar Lukas Matt

Add WebfingerJson struct to library

parent 3a687bd6
......@@ -29,6 +29,7 @@ type WebFinger struct {
Xrd WebfingerXml
}
// TODO XML webfinger is deprecated
type WebfingerXml struct {
XMLName xml.Name `xml:"XRD"`
Xmlns string `xml:"xmlns,attr"`
......@@ -45,6 +46,19 @@ type WebfingerXmlLink struct {
Href string `xml:"href,attr,omitempty"`
}
type WebfingerJson struct {
Subject string `json:"subject"`
Aliases []string `json:"aliases"`
Links []WebfingerJsonLink `json:"links"`
}
type WebfingerJsonLink struct {
Rel string `json:"rel"`
Type string `json:"type,omitempty"`
Href string `json:"href,omitempty"`
Template string `json:"template,omitempty"`
}
func (w *WebFinger) Discovery() error {
err := FetchXml("GET", w.Host + "/.well-known/host-meta", nil, &w.Xrd)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment