plugins/autohttpagent: fix for ln api change
This commit is contained in:
parent
334f483574
commit
9b56d5f1ce
|
@ -1,6 +1,9 @@
|
||||||
|
// +build linux
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -31,6 +34,9 @@ func mustEnv(key string, def string) string {
|
||||||
|
|
||||||
func doHttpAgent() {
|
func doHttpAgent() {
|
||||||
go func() {
|
go func() {
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
cfg := &tun2.ClientConfig{
|
cfg := &tun2.ClientConfig{
|
||||||
TLSConfig: &tls.Config{},
|
TLSConfig: &tls.Config{},
|
||||||
ConnType: connMethod,
|
ConnType: connMethod,
|
||||||
|
@ -43,9 +49,7 @@ func doHttpAgent() {
|
||||||
client, _ := tun2.NewClient(cfg)
|
client, _ := tun2.NewClient(cfg)
|
||||||
err := client.Connect()
|
err := client.Connect()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ln.Error(err, ln.F{
|
ln.Error(ctx, err, ln.Action("client connection error, restarting"))
|
||||||
"action": "client_running",
|
|
||||||
})
|
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue