system tray

This commit is contained in:
idk
2022-02-14 23:42:08 -05:00
parent f5ec1672ab
commit 060d885666
9 changed files with 2716 additions and 24 deletions

11
go.mod
View File

@ -4,7 +4,9 @@ go 1.17
require (
github.com/cloudfoundry/jibber_jabber v0.0.0-20151120183258-bcc4c8345a21
github.com/eyedeekay/go-i2pcontrol v0.0.0-20200110011336-510cca77e350
github.com/eyedeekay/go-i2pd v0.0.0-20220213070306-9807541b2dfc
github.com/getlantern/systray v1.1.0
github.com/go-ole/go-ole v1.2.6
github.com/jchavannes/go-pgp v0.0.0-20200131171414-e5978e6d02b4
golang.org/x/crypto v0.0.0-20220112180741-5e0467b6c7ce
@ -15,9 +17,18 @@ require (
github.com/eyedeekay/go-i2cp v0.0.0-20190716135428-6d41bed718b0 // indirect
github.com/eyedeekay/goSam v0.32.31-0.20210415231611-c6d9c0e340b8 // indirect
github.com/eyedeekay/sam-forwarder v0.0.0-20190908210105-71ca8cd65fda // indirect
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 // indirect
github.com/getlantern/errors v1.0.1 // indirect
github.com/getlantern/golog v0.0.0-20201105130739-9586b8bde3a9 // indirect
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 // indirect
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 // indirect
github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6 // indirect
github.com/go-stack/stack v1.8.0 // indirect
github.com/gtank/cryptopasta v0.0.0-20170601214702-1f550f6f2f69 // indirect
github.com/mwitkow/go-http-dialer v0.0.0-20161116154839-378f744fb2b8 // indirect
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c // indirect
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 // indirect
github.com/ybbus/jsonrpc v2.1.2+incompatible // indirect
github.com/zieckey/goini v0.0.0-20180118150432-0da17d361d26 // indirect
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 // indirect

20
go.sum
View File

@ -27,7 +27,10 @@ github.com/eyedeekay/eephttpd v0.0.0-20190903000420-52f5a8485a4e/go.mod h1:wFPQs
github.com/eyedeekay/go-fpw v0.0.0-20200512022837-c8b4dcdc74d4/go.mod h1:RyCx7KuH+5ryvIpUF7SpxiChLtjeuPbVFCIzf8shIFc=
github.com/eyedeekay/go-i2cp v0.0.0-20190716135428-6d41bed718b0 h1:rnn9OlD/3+tATEZNuiMR1C84O5CX8bZL2qqgttprKrw=
github.com/eyedeekay/go-i2cp v0.0.0-20190716135428-6d41bed718b0/go.mod h1:+P0fIhkqIYjo7exMJRTlSteRMbRyHbiBiKw+YlPWk+c=
github.com/eyedeekay/go-i2pcontrol v0.0.0-20200110011336-510cca77e350 h1:LxSh6dLIeiDfXxex1B+jFh7YyI7OuBza+IXS+SFzuLQ=
github.com/eyedeekay/go-i2pcontrol v0.0.0-20200110011336-510cca77e350/go.mod h1:bhIQsVpbNNXMtcoZ9UF4hLQleOjaCgKGXiRRhNc8TOA=
github.com/eyedeekay/go-i2pcontrol v0.0.0-20201227222421-6e9f31a29a91 h1:GjdUYLGSC4SBTKuuQ3K3+iLbFihCpBIO8VRjF7GNEYw=
github.com/eyedeekay/go-i2pcontrol v0.0.0-20201227222421-6e9f31a29a91/go.mod h1:bhIQsVpbNNXMtcoZ9UF4hLQleOjaCgKGXiRRhNc8TOA=
github.com/eyedeekay/go-i2pd v0.0.0-20220213070306-9807541b2dfc h1:ozp8Cxn9nsFF+p4tMcE63G0Kx+2lEywlCW0EvtISEZg=
github.com/eyedeekay/go-i2pd v0.0.0-20220213070306-9807541b2dfc/go.mod h1:Yg8xCWRLyq0mezPV+xJygBhJCf7wYsIdXbYGQk5tnW8=
github.com/eyedeekay/goSam v0.1.1-0.20190814204230-d4c9b8c57dd6/go.mod h1:kGTfZrncJ4CwMX3d1qA6bcMJTOcuTbOqgWg7WrFNAQ0=
@ -186,15 +189,25 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/garyburd/redigo v1.1.1-0.20170914051019-70e1b1943d4f/go.mod h1:NR3MbYisc3/PwhQ00EMzDiPmrwpPxAn5GI05/YaO1SY=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520 h1:NRUJuo3v3WGC/g5YiyF790gut6oQr5f3FBI88Wv0dx4=
github.com/getlantern/context v0.0.0-20190109183933-c447772a6520/go.mod h1:L+mq6/vvYHKjCX2oez0CgEAJmbq1fbb/oNJIWQkBybY=
github.com/getlantern/errors v0.0.0-20190325191628-abdb3e3e36f7/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A=
github.com/getlantern/errors v1.0.1 h1:XukU2whlh7OdpxnkXhNH9VTLVz0EVPGKDV5K0oWhvzw=
github.com/getlantern/errors v1.0.1/go.mod h1:l+xpFBrCtDLpK9qNjxs+cHU6+BAdlBaxHqikB6Lku3A=
github.com/getlantern/go-socks5 v0.0.0-20171114193258-79d4dd3e2db5/go.mod h1:kGHRXch95rnGLHjER/GhhFiHvfnqNz7KqWD9kGfATHY=
github.com/getlantern/golog v0.0.0-20190830074920-4ef2e798c2d7/go.mod h1:zx/1xUUeYPy3Pcmet8OSXLbF47l+3y6hIPpyLWoR9oc=
github.com/getlantern/golog v0.0.0-20201105130739-9586b8bde3a9 h1:8MYJU90rB1bsavemKSAuDKBjtAKo5xq95bEPOnzV7CE=
github.com/getlantern/golog v0.0.0-20201105130739-9586b8bde3a9/go.mod h1:ZyIjgH/1wTCl+B+7yH1DqrWp6MPJqESmwmEQ89ZfhvA=
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7 h1:micT5vkcr9tOVk1FiH8SWKID8ultN44Z+yzd2y/Vyb0=
github.com/getlantern/hex v0.0.0-20190417191902-c6586a6fe0b7/go.mod h1:dD3CgOrwlzca8ed61CsZouQS5h5jIzkK9ZWrTcf0s+o=
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55 h1:XYzSdCbkzOC0FDNrgJqGRo8PCMFOBFL9py72DRs7bmc=
github.com/getlantern/hidden v0.0.0-20190325191715-f02dbb02be55/go.mod h1:6mmzY2kW1TOOrVy+r41Za2MxXM+hhqTtY3oBKd2AgFA=
github.com/getlantern/netx v0.0.0-20190110220209-9912de6f94fd/go.mod h1:wKdY0ikOgzrWSeB9UyBVKPRhjXQ+vTb+BPeJuypUuNE=
github.com/getlantern/ops v0.0.0-20190325191751-d70cb0d6f85f/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6 h1:QthAQCekS1YOeYWSvoHI6ZatlG4B+GBDLxV/2ZkBsTA=
github.com/getlantern/ops v0.0.0-20200403153110-8476b16edcd6/go.mod h1:D5ao98qkA6pxftxoqzibIBBrLSUli+kYnJqrgBf9cIA=
github.com/getlantern/systray v1.1.0 h1:U0wCEqseLi2ok1fE6b88gJklzriavPJixZysZPkZd/Y=
github.com/getlantern/systray v1.1.0/go.mod h1:AecygODWIsBquJCJFop8MEQcJbWFfw/1yWbVabNgpCM=
github.com/go-gl/gl v0.0.0-20181026044259-55b76b7df9d2/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
github.com/go-gl/gl v0.0.0-20210501111010-69f74958bac0/go.mod h1:wjpnOv6ONl2SuJSxqCPVaPZibGFdSci9HFocT9qtVYM=
github.com/go-gl/glfw v0.0.0-20210410170116-ea3d685f79fb/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
@ -202,6 +215,7 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-stack/stack v1.6.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-stack/stack v1.8.0 h1:5SgMzNM5HxrEjV0ww2lTmX6E2Izsfxas4+YHWRs3Lsk=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
@ -282,6 +296,7 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU=
github.com/onsi/gomega v1.5.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE=
@ -293,6 +308,7 @@ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6
github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo=
github.com/otiai10/mint v1.3.3 h1:7JgpsBaN0uMkyju4tbYHu0mnM55hNKVYLsXmwr15NQI=
github.com/otiai10/mint v1.3.3/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c h1:rp5dCmg/yLR3mgFuSOe4oEnDDmGLROTvMragMUXpTQw=
github.com/oxtoacart/bpool v0.0.0-20190530202638-03653db5a59c/go.mod h1:X07ZCGwUbLaax7L0S3Tw4hpejzu63ZrrQiUe6W0hcy0=
github.com/pelletier/go-toml v1.0.1-0.20170904195809-1d6b12b7cb29/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic=
github.com/phayes/freeport v0.0.0-20180830031419-95f893ade6f2 h1:JhzVVoYvbOACxoUmOs6V/G4D5nPVUW73rKvXxP4XUJc=
@ -327,7 +343,10 @@ github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8=
github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
github.com/veandco/go-sdl2 v0.4.0/go.mod h1:FB+kTpX9YTE+urhYiClnRzpOXbiWgaU3+5F2AB78DPg=
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos=
github.com/ybbus/jsonrpc v2.1.2+incompatible h1:V4mkE9qhbDQ92/MLMIhlhMSbz8jNXdagC3xBR5NDwaQ=
github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE=
github.com/ybbus/jsonrpc/v2 v2.1.6 h1:++pboiaaD6TZ9FJ1JOBBRB/tPtR1njYzqz1iSZGv+3Y=
github.com/ybbus/jsonrpc/v2 v2.1.6/go.mod h1:rIuG1+ORoiqocf9xs/v+ecaAVeo3zcZHQgInyKFMeg0=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/zieckey/goini v0.0.0-20180118150432-0da17d361d26 h1:E0lEWrifmR0ACbGf5PLji1XbW6rtIXLHCXO/YOqi0AE=
github.com/zieckey/goini v0.0.0-20180118150432-0da17d361d26/go.mod h1:TQpdgg7I9+PFIkatlx/dnZyZb4iZyCUx1HJj4rXi3+E=
@ -378,6 +397,7 @@ golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=

BIN
icon/icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

1117
icon/icon_notwin.go Normal file

File diff suppressed because it is too large Load Diff

1420
icon/icon_windows.go Normal file

File diff suppressed because it is too large Load Diff

45
main.go
View File

@ -113,20 +113,19 @@ func main() {
log.Println("Starting I2P routerconsole in Tor Browser")
*i2pconfig = true
} else if filename == "firefox" || *clearnet || *offline {
log.Println("Starting Firefox from Tor Browser package")
*clearnet = true
if *profile == "" {
if *offline {
*profile = filepath.Join(tbget.WORKING_DIR, "profile.firefox.offline")
} else if *clearnet {
*profile = filepath.Join(tbget.WORKING_DIR, "profile.firefox")
} else {
*profile = filepath.Join(tbget.WORKING_DIR, "profile.firefox.tor")
}
}
if *profile == "" {
if *offline {
*profile = filepath.Join(tbget.WORKING_DIR, "profile.firefox.offline")
} else if *clearnet {
*profile = filepath.Join(tbget.WORKING_DIR, "profile.firefox")
} else {
*profile = filepath.Join(tbget.WORKING_DIR, *profile)
*profile = filepath.Join(tbget.WORKING_DIR, "profile.firefox.default")
}
log.Println("Using profile", *profile)
} else {
*profile = filepath.Join(tbget.WORKING_DIR, *profile)
}
if *i2pbrowser && *torbrowser {
log.Fatal("Please don't open I2P and Tor Browser at the same time when running from the terminal.")
@ -166,6 +165,7 @@ func main() {
closer := InitI2PSAM()
defer closer()
go StartI2P()
go runSysTray(true)
defer StopI2P()
if tbget.TestHTTPDefaultProxy() {
log.Println("I2P HTTP proxy OK")
@ -221,17 +221,7 @@ func main() {
}
client.TBS.UnpackI2PAppData()
client.TBS.UnpackI2PData()
if *profile != "" {
log.Println("Using a custom profile")
if err := client.TBS.RunTBBWithOfflineClearnetProfile(*profile, *offline, *clearnet); err != nil {
log.Fatal(err)
}
} else if *offline {
log.Println("Working offline")
if err := client.TBS.RunTBBWithOfflineClearnetProfile(*profile, *offline, *clearnet); err != nil {
log.Fatal(err)
}
} else if *i2pbrowser {
if *i2pbrowser {
if err := client.TBS.RunI2PBWithLang(); err != nil {
log.Fatal(err)
}
@ -243,10 +233,21 @@ func main() {
if err := client.TBS.RunTBWithLang(); err != nil {
log.Fatal(err)
}
} else if *offline {
log.Println("Working offline")
if err := client.TBS.RunTBBWithOfflineClearnetProfile(*profile, *offline, *clearnet); err != nil {
log.Fatal(err)
}
} else if *clearnet {
log.Println("Using a custom profile")
if err := client.TBS.RunTBBWithOfflineClearnetProfile(*profile, *offline, *clearnet); err != nil {
log.Fatal(err)
}
} else {
if *bemirror {
go client.TBD.Serve()
}
go runSysTray(false)
if err := client.Serve(); err != nil {
log.Fatal(err)
}

8
no-systray.go Normal file
View File

@ -0,0 +1,8 @@
//go:build nosystray
// +build nosystray
package main
func runSysTray(down bool) {
}

View File

@ -1,6 +1,7 @@
package tbserve
import (
"context"
"embed"
"io/ioutil"
"log"
@ -23,6 +24,7 @@ type Client struct {
DarkMode bool
Host string
Port int
server http.Server
}
// NewClient creates a new Client.
@ -130,8 +132,17 @@ func (m *Client) Serve() error {
if err != nil {
return err
}
m.server = http.Server{
Addr: m.GetAddress(),
Handler: nosurf.New(m),
}
ioutil.WriteFile(filepath.Join(m.TBD.DownloadPath, "mirror.json"), []byte(mirrorjson), 0644)
cp.Copy(m.TBS.I2PProfilePath(), filepath.Join(m.TBD.DownloadPath, "i2p.firefox"))
go m.TBS.RunTorWithLang()
return http.ListenAndServe(m.GetAddress(), nosurf.New(m))
return m.server.ListenAndServe() //http.ListenAndServe(m.GetAddress(), nosurf.New(m))
}
func (m *Client) Shutdown(ctx context.Context) error {
m.TBS.StopTor()
return m.server.Shutdown(ctx)
}

104
systray.go Normal file
View File

@ -0,0 +1,104 @@
//go:build !nosystray
// +build !nosystray
package main
import (
"context"
"fmt"
"log"
"time"
"github.com/eyedeekay/go-i2pcontrol"
"github.com/getlantern/systray"
"i2pgit.org/idk/i2p.plugins.tor-manager/icon"
)
var running = false
var shutdown = false
func onReady() {
systray.SetTemplateIcon(icon.Data, icon.Data)
systray.SetTitle("Tor Manager for I2P")
systray.SetTooltip("Tor and I2P integrated")
// We can manipulate the systray in other goroutines
go func() {
systray.SetTemplateIcon(icon.Data, icon.Data)
systray.SetTitle("Tor Managing I2P Browser Plugin")
systray.SetTooltip("Configures I2P and Tor in the same browser")
mEnabled := systray.AddMenuItem("Online", "I2P and Tor are both running")
// Sets the icon of a menu item. Only available on Mac.
mEnabled.SetTemplateIcon(icon.Data, icon.Data)
subMenuTop := systray.AddMenuItem("Launch a Browser", "Launch a browser")
subMenuBottom := subMenuTop.AddSubMenuItem("Launch Tor Browser configured for I2P", "Modify and launch the Tor Browser Bundle for I2P")
subMenuBottom2 := subMenuTop.AddSubMenuItem("Launch the Tor Browser", "Launch the standard Tor Browser bundle")
subMenuBottom3 := subMenuTop.AddSubMenuItem("Launch Hardened Firefox in Clearnet Mode", "Launch the Tor Browser bundle, but without Tor")
systray.AddSeparator()
mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
// Sets the icon of a menu item. Only available on Mac.
mQuit.SetIcon(icon.Data)
for {
select {
case <-mEnabled.ClickedCh:
mEnabled.SetTitle("I2P and Tor are both running")
time.Sleep(time.Second * 3)
mEnabled.SetTitle("Online")
case <-subMenuBottom.ClickedCh:
fmt.Println("Launching Tor Browser configured for I2P")
if err := client.TBS.RunI2PBWithLang(); err != nil {
log.Println(err)
}
case <-subMenuBottom2.ClickedCh:
fmt.Println("Launching the Tor Browser")
if err := client.TBS.RunTBWithLang(); err != nil {
log.Println(err)
}
case <-subMenuBottom3.ClickedCh:
fmt.Println("Launching Hardened Firefox in Clearnet Mode")
if err := client.TBS.RunTBBWithOfflineClearnetProfile(*profile, false, true); err != nil {
log.Println(err)
}
case <-mQuit.ClickedCh:
systray.Quit()
fmt.Println("Quit now...")
return
}
time.Sleep(time.Second * 1)
}
}()
}
func onExit() {
if shutdown {
i2pcontrol.Initialize("127.0.0.1", "7657", "")
_, err := i2pcontrol.Authenticate("itoopie")
if err != nil {
log.Println(err)
}
message, err := i2pcontrol.ShutdownGraceful()
if err != nil {
log.Println(err)
}
log.Println(message)
}
running = false
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := client.Shutdown(ctx); err != nil {
panic(err)
}
}
func runSysTray(down bool) {
if !running {
running = true
shutdown = down
systray.Run(onReady, onExit)
}
}