-
Notifications
You must be signed in to change notification settings - Fork 1
/
xml.go
54 lines (45 loc) · 1.01 KB
/
xml.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package Usom
import (
"encoding/xml"
"github.com/astaxie/beego/httplib"
)
/*
XML Parsing Structs for https://www.usom.gov.tr/url-list.xml
*/
type UsomData struct {
XMLName xml.Name `xml:"usom-data"`
XMLInfo XMLInfo `xml:"xml-info"`
UrlList UrlList `xml:"url-list"`
}
type XMLInfo struct {
XMLName xml.Name `xml:"xml-info"`
Updated string `xml:"updated"`
Author string `xml:"author"`
}
type UrlList struct {
XMLName xml.Name `xml:"url-list"`
UrlInfo []UrlInfo `xml:"url-info"`
}
type UrlInfo struct {
XMLName xml.Name `xml:"url-info"`
Id int32 `xml:"id"`
Url string `xml:"url"`
Desc string `xml:"desc"`
Source string `xml:"source"`
Date string `xml:"date"`
}
/*
Pong structs
for the ip address and hostnames in the given network
shortly: result struct
*/
type Pong struct {
IP string
Hostname string
}
/*
Global Variables
*/
var t = UsomData{}
var usomUrlList, _ = httplib.Get("https://www.usom.gov.tr/url-list.xml").Bytes()
var done = xml.Unmarshal(usomUrlList, &t)