mirror of
https://github.com/safing/portbase
synced 2025-09-09 13:55:47 +00:00
Initial commit after restructure
This commit is contained in:
commit
96ec15b39b
70 changed files with 6945 additions and 0 deletions
31
api/api.go
Normal file
31
api/api.go
Normal file
|
@ -0,0 +1,31 @@
|
|||
// Copyright Safing ICS Technologies GmbH. Use of this source code is governed by the AGPL license that can be found in the LICENSE file.
|
||||
|
||||
package api
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/Safing/safing-core/log"
|
||||
"github.com/Safing/safing-core/modules"
|
||||
)
|
||||
|
||||
var (
|
||||
apiModule *modules.Module
|
||||
apiAddress = ":18"
|
||||
)
|
||||
|
||||
func Start() {
|
||||
apiModule = modules.Register("Api", 32)
|
||||
|
||||
go run()
|
||||
|
||||
<-apiModule.Stop
|
||||
apiModule.StopComplete()
|
||||
}
|
||||
|
||||
func run() {
|
||||
router := NewRouter()
|
||||
|
||||
log.Infof("api: starting to listen on %s", apiAddress)
|
||||
log.Errorf("api: listener failed: %s", http.ListenAndServe(apiAddress, router))
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue