mirror of
https://github.com/openp2p-cn/openp2p.git
synced 2026-04-14 10:32:21 +08:00
install error
This commit is contained in:
@@ -48,7 +48,10 @@ func (c *Config) add(app AppConfig) {
|
||||
|
||||
func (c *Config) save() {
|
||||
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 {
|
||||
|
||||
10
daemon.go
10
daemon.go
@@ -148,11 +148,15 @@ func install() {
|
||||
config.SrcPort = *srcPort
|
||||
config.Protocol = *protocol
|
||||
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()
|
||||
|
||||
// copy files
|
||||
os.MkdirAll(defaultInstallPath, 0775)
|
||||
|
||||
targetPath := filepath.Join(defaultInstallPath, defaultBinName)
|
||||
binPath, _ := os.Executable()
|
||||
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{""}
|
||||
gLog.Println(LevelINFO, "targetPath:", targetPath)
|
||||
err := d.Control("install", targetPath, []string{"-d", "-f"})
|
||||
err = d.Control("install", targetPath, []string{"-d", "-f"})
|
||||
if err != nil {
|
||||
gLog.Println(LevelERROR, "install system service error:", err)
|
||||
} else {
|
||||
|
||||
13
errorcode.go
Normal file
13
errorcode.go
Normal file
@@ -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")
|
||||
)
|
||||
11
protocol.go
11
protocol.go
@@ -4,14 +4,13 @@ import (
|
||||
"bytes"
|
||||
"encoding/binary"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"hash/crc64"
|
||||
"math/big"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
|
||||
const OpenP2PVersion = "0.97.0"
|
||||
const OpenP2PVersion = "0.97.1"
|
||||
const ProducnName string = "openp2p"
|
||||
|
||||
type openP2PHeader struct {
|
||||
@@ -131,14 +130,6 @@ const (
|
||||
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
|
||||
const (
|
||||
NATNone = 0
|
||||
|
||||
Reference in New Issue
Block a user