mirror of
https://github.com/go-i2p/go-i2pcontrol.git
synced 2025-07-01 20:19:59 -04:00
fixed beginning of demo
This commit is contained in:
@ -5,12 +5,12 @@ Hash: SHA256
|
||||
An easy-to-use library for the i2pcontrol rpc interface.
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAlrDDKEACgkQ11wDs5te
|
||||
FOHo/Qf/TKrG0PhngCeJwjqWk0G4mYUhrJEHHC4G0P1CgSmXEbIfbXQ24+YX7zvx
|
||||
dKrvI2edL7cyU1ibGVNacO7kSxtZmG1GhpMSEGdDwQ/i0jY3Oir/OojNZ2JXwn2Q
|
||||
A4mJhZ3d4gDUNw5W4c0EnLhmYsRMDvQPrhKcMq6njUxzPdBzyWEIo46GVIlAET73
|
||||
YgzJv9TXaqMvqd6K/N+lQ4cDH4z42Fhsr1PcHtnQ4CO9YzsvJZqy8f5MUvKmeqiX
|
||||
NunISDuSJPMmF/E2l+oePKdiukjdzILSz6aww7PrgtZJXFLVHQ2ZYDWgqQek0QkU
|
||||
xUlX5oFk7o3+g+5uD5Go/sjPr8mn8w==
|
||||
=qJIw
|
||||
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAlrDF6wACgkQ11wDs5te
|
||||
FOEYmwf/QtH6E8nf432zsG0eB0MvAFUWmxUEybbBUfMNCJue+YaCb2JZgQQ5lAY5
|
||||
Sw+PgMJNOHXk6uWDRq/M900HAqG05PtPZgVOzSa1BeZsqwcxdZYAiHyzRW1Yrrby
|
||||
N9C4rINu0cXpd5xqAVZ7opdmkh30Wz5f5+A8lqqTHo3/C9un1fuyk0wYWelccHN+
|
||||
/VtsEJyo/aQoAFlVk5AWGWQ1datwCNWbYmZ1Wyy0GJLcAK/gGDFoP1SejvKnb4l8
|
||||
IobKKvm9bOidM1M9dk/Ks7ufPK1LT2ezuQ2rhKwRA67T51lyAgF+QDUwDI/yCLja
|
||||
sccXYPn6OZGtGdZCPsEeBfU2pu9VeA==
|
||||
=fytC
|
||||
-----END PGP SIGNATURE-----
|
||||
|
4
auth.go
4
auth.go
@ -16,8 +16,8 @@ func (i *i2pControlStructure) i2pControlPort() string{
|
||||
return i.i2pcontrolport
|
||||
}
|
||||
|
||||
func (i *i2pControlStructure) Echo(s string) {
|
||||
fmt.Println(i.jsonstructure.Echo("echo", ""))
|
||||
func (i *i2pControlStructure) Echo(s ...string) {
|
||||
fmt.Println(i.jsonstructure.Echo(s...))
|
||||
}
|
||||
|
||||
func (i *i2pControlStructure) i2pControl() i2pControlStructure {
|
||||
|
20
example/Makefile
Normal file
20
example/Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
UNAME ?= $(shell uname -s | tr '[:upper:]' '[:lower:]')
|
||||
UARCH ?= $(shell uname -m | tr '[:upper:]' '[:lower:]' | sed 's|x86_64|amd64|g')
|
||||
|
||||
rebuild: clean update demo
|
||||
|
||||
clean:
|
||||
rm -f demo-$(UNAME)
|
||||
|
||||
update:
|
||||
go get -u github.com/eyedeekay/go-i2pcontrol; true
|
||||
|
||||
demo:
|
||||
GOOS="$(UNAME)" GOARCH="$(UARCH)" go build \
|
||||
-a \
|
||||
-tags netgo \
|
||||
-ldflags '-w -extldflags "-static"' \
|
||||
-o demo-"$(UNAME)" \
|
||||
./
|
||||
|
BIN
example/demo-linux
Executable file
BIN
example/demo-linux
Executable file
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
package i2pcontroldemo
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
@ -11,9 +11,14 @@ func main(){
|
||||
"host: of the i2pcontrol interface")
|
||||
PortString := flag.String("port", "7650",
|
||||
":port of the i2pcontrol interface")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
i2pcontrolhost := *AddrString
|
||||
i2pcontrolport := *PortString
|
||||
|
||||
auth := i2pcontrol.NewI2pControl(i2pcontrolhost, i2pcontrolport)
|
||||
|
||||
auth.Echo("test")
|
||||
|
||||
}
|
||||
|
8
json.go
8
json.go
@ -11,10 +11,10 @@ func (j *jsonStructure) Id() string {
|
||||
|
||||
func (j *jsonStructure) Format(m string, s []string) string {
|
||||
rstring := "{\n"
|
||||
rstring += "method: \"" + m +"\"\n"
|
||||
rstring += "jsonrpc: \"2.0\"\n"
|
||||
rstring += "id: \"" + j.Id() + "\"\n"
|
||||
rstring += "params: \""
|
||||
rstring += " method: \"" + m +"\"\n"
|
||||
rstring += " jsonrpc: \"2.0\"\n"
|
||||
rstring += " id: \"" + j.Id() + "\"\n"
|
||||
rstring += " params: \""
|
||||
for _, value := range s {
|
||||
rstring += value + " "
|
||||
}
|
||||
|
Reference in New Issue
Block a user