File: canid.go

package info (click to toggle)
hellfire 0.0~git20180708.bf3c390-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 96 kB
  • sloc: makefile: 2
file content (27 lines) | stat: -rw-r--r-- 495 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package hellfire // import "pathspider.net/hellfire"

import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net"
	"net/http"
)

func GetAdditionalInfo(ip net.IP, canidAddress string) map[string]interface{} {
	url := fmt.Sprintf("http://%s/prefix.json?addr=%s", canidAddress, ip.String())

	res, err := http.Get(url)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()

	body, err := ioutil.ReadAll(res.Body)

	var info map[string]interface{}
	json.Unmarshal([]byte(body), &info)

	return info
}