route/cmd/api/main.go

29 lines
483 B
Go

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{
APIKey: "hunter2",
PrivKey: nil,
}
resp := &routerpc.AddHostResponse{}
err = client.Call("Urls.AddHost", req, resp)
if err != nil {
log.Fatal(err)
}
log.Printf("Created host %s (%s) with token %s", resp.Hostname, resp.OnionHostname, resp.Token)
}