mirror of
https://gitlab.com/pulsechaincom/go-pulse.git
synced 2024-12-25 12:57:17 +00:00
Added client string to configuration
Clients can set their own client string which will be send to connected peers during the handshake.
This commit is contained in:
parent
826c827e6b
commit
344e827061
@ -6,6 +6,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path"
|
"path"
|
||||||
|
"runtime"
|
||||||
)
|
)
|
||||||
|
|
||||||
type LogType byte
|
type LogType byte
|
||||||
@ -19,12 +20,13 @@ const (
|
|||||||
type config struct {
|
type config struct {
|
||||||
Db Database
|
Db Database
|
||||||
|
|
||||||
Log *Logger
|
Log *Logger
|
||||||
ExecPath string
|
ExecPath string
|
||||||
Debug bool
|
Debug bool
|
||||||
Ver string
|
Ver string
|
||||||
Pubkey []byte
|
ClientString string
|
||||||
Seed bool
|
Pubkey []byte
|
||||||
|
Seed bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var Config *config
|
var Config *config
|
||||||
@ -48,6 +50,7 @@ func ReadConfig(base string) *config {
|
|||||||
|
|
||||||
Config = &config{ExecPath: path, Debug: true, Ver: "0.3.1"}
|
Config = &config{ExecPath: path, Debug: true, Ver: "0.3.1"}
|
||||||
Config.Log = NewLogger(LogFile|LogStd, LogLevelDebug)
|
Config.Log = NewLogger(LogFile|LogStd, LogLevelDebug)
|
||||||
|
Config.ClientString = fmt.Sprintf("/Ethereum(G) v%s/%s", Config.Ver, runtime.GOOS)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Config
|
return Config
|
||||||
|
3
peer.go
3
peer.go
@ -7,7 +7,6 @@ import (
|
|||||||
"github.com/ethereum/eth-go/ethutil"
|
"github.com/ethereum/eth-go/ethutil"
|
||||||
"github.com/ethereum/eth-go/ethwire"
|
"github.com/ethereum/eth-go/ethwire"
|
||||||
"net"
|
"net"
|
||||||
"runtime"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
@ -158,7 +157,7 @@ func NewOutboundPeer(addr string, ethereum *Ethereum, caps Caps) *Peer {
|
|||||||
connected: 0,
|
connected: 0,
|
||||||
disconnect: 0,
|
disconnect: 0,
|
||||||
caps: caps,
|
caps: caps,
|
||||||
Version: fmt.Sprintf("/Ethereum(G) v%s/%s", ethutil.Config.Ver, runtime.GOOS),
|
Version: ethutil.Config.ClientString,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up the connection in another goroutine so we don't block the main thread
|
// Set up the connection in another goroutine so we don't block the main thread
|
||||||
|
Loading…
Reference in New Issue
Block a user