install error
This commit is contained in:
@@ -48,7 +48,10 @@ func (c *Config) add(app AppConfig) {
|
|||||||
|
|
||||||
func (c *Config) save() {
|
func (c *Config) save() {
|
||||||
data, _ := json.MarshalIndent(c, "", "")
|
data, _ := json.MarshalIndent(c, "", "")
|
||||||
ioutil.WriteFile("config.json", data, 0644)
|
err := ioutil.WriteFile("config.json", data, 0644)
|
||||||
|
if err != nil {
|
||||||
|
gLog.Println(LevelERROR, "save config.json error:", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) load() error {
|
func (c *Config) load() error {
|
||||||
|
|||||||
@@ -148,11 +148,15 @@ func install() {
|
|||||||
config.SrcPort = *srcPort
|
config.SrcPort = *srcPort
|
||||||
config.Protocol = *protocol
|
config.Protocol = *protocol
|
||||||
gConf.add(config)
|
gConf.add(config)
|
||||||
os.Chdir(defaultInstallPath)
|
os.MkdirAll(defaultInstallPath, 0775)
|
||||||
|
err := os.Chdir(defaultInstallPath)
|
||||||
|
if err != nil {
|
||||||
|
gLog.Println(LevelERROR, "cd error:", err)
|
||||||
|
}
|
||||||
gConf.save()
|
gConf.save()
|
||||||
|
|
||||||
// copy files
|
// copy files
|
||||||
os.MkdirAll(defaultInstallPath, 0775)
|
|
||||||
targetPath := filepath.Join(defaultInstallPath, defaultBinName)
|
targetPath := filepath.Join(defaultInstallPath, defaultBinName)
|
||||||
binPath, _ := os.Executable()
|
binPath, _ := os.Executable()
|
||||||
src, errFiles := os.Open(binPath) // can not use args[0], on Windows call openp2p is ok(=openp2p.exe)
|
src, errFiles := os.Open(binPath) // can not use args[0], on Windows call openp2p is ok(=openp2p.exe)
|
||||||
@@ -180,7 +184,7 @@ func install() {
|
|||||||
|
|
||||||
// args := []string{""}
|
// args := []string{""}
|
||||||
gLog.Println(LevelINFO, "targetPath:", targetPath)
|
gLog.Println(LevelINFO, "targetPath:", targetPath)
|
||||||
err := d.Control("install", targetPath, []string{"-d", "-f"})
|
err = d.Control("install", targetPath, []string{"-d", "-f"})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
gLog.Println(LevelERROR, "install system service error:", err)
|
gLog.Println(LevelERROR, "install system service error:", err)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"errors"
|
||||||
|
)
|
||||||
|
|
||||||
|
// error message
|
||||||
|
var (
|
||||||
|
// ErrorS2S string = "s2s is not supported"
|
||||||
|
// ErrorHandshake string = "handshake error"
|
||||||
|
ErrorS2S = errors.New("s2s is not supported")
|
||||||
|
ErrorHandshake = errors.New("handshake error")
|
||||||
|
)
|
||||||
+1
-10
@@ -4,14 +4,13 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
|
||||||
"hash/crc64"
|
"hash/crc64"
|
||||||
"math/big"
|
"math/big"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const OpenP2PVersion = "0.97.0"
|
const OpenP2PVersion = "0.97.1"
|
||||||
const ProducnName string = "openp2p"
|
const ProducnName string = "openp2p"
|
||||||
|
|
||||||
type openP2PHeader struct {
|
type openP2PHeader struct {
|
||||||
@@ -131,14 +130,6 @@ const (
|
|||||||
NatTestTimeout = time.Second * 10
|
NatTestTimeout = time.Second * 10
|
||||||
)
|
)
|
||||||
|
|
||||||
// error message
|
|
||||||
var (
|
|
||||||
// ErrorS2S string = "s2s is not supported"
|
|
||||||
// ErrorHandshake string = "handshake error"
|
|
||||||
ErrorS2S = errors.New("s2s is not supported")
|
|
||||||
ErrorHandshake = errors.New("handshake error")
|
|
||||||
)
|
|
||||||
|
|
||||||
// NATNone has public ip
|
// NATNone has public ip
|
||||||
const (
|
const (
|
||||||
NATNone = 0
|
NATNone = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user