2017-01-18 09:57:18 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
"net/rpc"
|
|
|
|
|
|
|
|
"git.xeserv.us/xena/route/routerpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
client, err := rpc.DialHTTP("tcp", "127.0.0.1:9234")
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
req := routerpc.AddHostRequest{
|
2017-01-18 17:01:52 +00:00
|
|
|
APIKey: "hunter2",
|
|
|
|
PrivKey: nil,
|
2017-01-18 09:57:18 +00:00
|
|
|
}
|
|
|
|
resp := &routerpc.AddHostResponse{}
|
|
|
|
|
|
|
|
err = client.Call("Urls.AddHost", req, resp)
|
|
|
|
if err != nil {
|
|
|
|
log.Fatal(err)
|
|
|
|
}
|
|
|
|
|
2017-01-18 10:22:52 +00:00
|
|
|
log.Printf("Created host %s (%s) with token %s", resp.Hostname, resp.OnionHostname, resp.Token)
|
2017-01-18 09:57:18 +00:00
|
|
|
}
|