mirror of
https://github.com/PeernetOfficial/Cmd.git
synced 2026-07-16 18:37:51 +01:00
Update core. Support for GeoIP database.
This commit is contained in:
2
API.go
2
API.go
@@ -39,6 +39,8 @@ func startAPI(backend *core.Backend, apiListen []string, apiKey uuid.UUID) {
|
||||
return
|
||||
}
|
||||
|
||||
api.InitGeoIPDatabase(config.GeoIPDatabase)
|
||||
|
||||
api.AllowKeyInParam = append(api.AllowKeyInParam, "/console")
|
||||
api.Router.HandleFunc("/console", apiConsole).Methods("GET")
|
||||
api.Router.HandleFunc("/shutdown", apiShutdown).Methods("GET")
|
||||
|
||||
@@ -162,14 +162,16 @@ func translateTerminateReason(reason int) string {
|
||||
return "Socket: The connection timed out when sending the initial handshake."
|
||||
case udt.TerminateReasonRemoteSentShutdown:
|
||||
return "Remote peer sent a shutdown message."
|
||||
case udt.TerminateReasonCannotProcessOutgoing:
|
||||
return "Send: Cannot process outgoing messages."
|
||||
case udt.TerminateReasonSocketClosed:
|
||||
return "Send: Socket closed. Called udtSocket.Close()."
|
||||
case udt.TerminateReasonInvalidPacketIDAck:
|
||||
return "Send: Invalid packet ID received in ACK message."
|
||||
case udt.TerminateReasonInvalidPacketIDNak:
|
||||
return "Send: Invalid packet ID received in NAK message."
|
||||
case udt.TerminateReasonCorruptPacketNak:
|
||||
return "Send: Invalid NAK packet received."
|
||||
case udt.TerminateReasonSignal:
|
||||
return "Send: Terminate signal. Called udtSocket.Terminate()."
|
||||
default:
|
||||
return "Unknown."
|
||||
}
|
||||
|
||||
3
Main.go
3
Main.go
@@ -19,7 +19,8 @@ const appName = "Peernet Cmd"
|
||||
|
||||
var config struct {
|
||||
// Log settings
|
||||
ErrorOutput int `yaml:"ErrorOutput"` // 0 = Log file (default), 1 = Command line, 2 = Log file + command line, 3 = None
|
||||
ErrorOutput int `yaml:"ErrorOutput"` // 0 = Log file (default), 1 = Command line, 2 = Log file + command line, 3 = None
|
||||
GeoIPDatabase string `yaml:"GeoIPDatabase"` // GeoLite2 City database to provide GeoIP information.
|
||||
|
||||
// API settings
|
||||
APIListen []string `yaml:"APIListen"` // WebListen is in format IP:Port and declares where the web-interface should listen on. IP can also be ommitted to listen on any.
|
||||
|
||||
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module github.com/PeernetOfficial/Cmd
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/PeernetOfficial/core v0.0.0-20211213155213-f18e651f40da
|
||||
github.com/PeernetOfficial/core v0.0.0-20211214020928-20a1d4552022
|
||||
github.com/google/uuid v1.3.0
|
||||
github.com/gorilla/websocket v1.4.3-0.20210424162022-e8629af678b7
|
||||
)
|
||||
|
||||
6
go.sum
6
go.sum
@@ -1,5 +1,7 @@
|
||||
github.com/PeernetOfficial/core v0.0.0-20211213155213-f18e651f40da h1:NkyhNAslkf/LPa7pWN9Plzlkbm2NHW8XEBfnI3TTf8E=
|
||||
github.com/PeernetOfficial/core v0.0.0-20211213155213-f18e651f40da/go.mod h1:tRL13e2o4/h55LDd+aM9QoGukc+3L3Zy0yK8jAh+PsE=
|
||||
github.com/IncSW/geoip2 v0.1.1 h1:afzzYF7n9JbdcPy8aiBSgBJuXi4mTWXZ3z6V3o6Vg34=
|
||||
github.com/IncSW/geoip2 v0.1.1/go.mod h1:adcasR40vXiUBjtzdaTTKL/6wSf+fgO4M8Gve/XzPUk=
|
||||
github.com/PeernetOfficial/core v0.0.0-20211214020928-20a1d4552022 h1:mztgQEIqop3tnNyW8ofvhgGRHkzFbxlCNM4jLB7Ct/g=
|
||||
github.com/PeernetOfficial/core v0.0.0-20211214020928-20a1d4552022/go.mod h1:VNhfwAZqya5JDZTS/ffa8Shof0OmQCx025CQMieGB7o=
|
||||
github.com/akrylysov/pogreb v0.10.1 h1:FqlR8VR7uCbJdfUob916tPM+idpKgeESDXOA1K0DK4w=
|
||||
github.com/akrylysov/pogreb v0.10.1/go.mod h1:pNs6QmpQ1UlTJKDezuRWmaqkgUE2TuU0YTWyqJZ7+lI=
|
||||
github.com/enfipy/locker v1.1.0 h1:2zVJ0ky7cS1Vjs0x6OQWFiT2dSEiHrI5/O2KCz1fgGc=
|
||||
|
||||
Reference in New Issue
Block a user