Update core. Support for GeoIP database.

This commit is contained in:
Kleissner
2021-12-14 03:29:26 +01:00
parent 073730377e
commit 9a3215c6cd
5 changed files with 13 additions and 6 deletions

2
API.go
View File

@@ -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")

View File

@@ -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."
}

View File

@@ -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
View File

@@ -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
View File

@@ -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=