Compare commits
46 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5990e8ee11 | ||
|
|
48d05eec7e | ||
|
|
bc2e582203 | ||
|
|
21e4231e24 | ||
|
|
b21101958d | ||
|
|
c3a3060129 | ||
|
|
a23f82e9fe | ||
|
|
c37dd87a37 | ||
|
|
8be5c80a22 | ||
|
|
47a065aaf9 | ||
|
|
5e1e4b9daf | ||
|
|
0f06128ce8 | ||
|
|
be07dc8749 | ||
|
|
e75d7c8b03 | ||
|
|
59c7705ca1 | ||
|
|
91ea59ed6e | ||
|
|
659cbe4072 | ||
|
|
9605b50198 | ||
|
|
c57c22f93a | ||
|
|
60b3f77e29 | ||
|
|
1c4b8a5995 | ||
|
|
836a69f914 | ||
|
|
5ee97416dd | ||
|
|
ecb1f3b2cf | ||
|
|
5203fb8543 | ||
|
|
7d6b09cf11 | ||
|
|
0fe813acd9 | ||
|
|
75eb31abf6 | ||
|
|
4b36598bd7 | ||
|
|
8e6b39c8bf | ||
|
|
2f88525257 | ||
|
|
3551cb035b | ||
|
|
e5c08f69a9 | ||
|
|
f5890c1563 | ||
|
|
c310414b7e | ||
|
|
9e2cd260d5 | ||
|
|
f37a69e75b | ||
|
|
c623d89f94 | ||
|
|
45b3b258c1 | ||
|
|
a0fe455bce | ||
|
|
7b9641f753 | ||
|
|
3d3dab91b9 | ||
|
|
408700367b | ||
|
|
c1d822b296 | ||
|
|
fd835b67dc | ||
|
|
49d8d03d8a |
89
.gitea/workflows/build.yml
Normal file
89
.gitea/workflows/build.yml
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
name: Build DBM Service
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
|
||||||
|
env:
|
||||||
|
APP_NAME: tecamino-dbm
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows
|
||||||
|
arch: amd64
|
||||||
|
ext: .exe
|
||||||
|
- os: linux
|
||||||
|
arch: amd64
|
||||||
|
ext: ""
|
||||||
|
- os: linux
|
||||||
|
arch: arm64
|
||||||
|
ext: ""
|
||||||
|
- os: linux
|
||||||
|
arch: arm
|
||||||
|
arm_version: 6
|
||||||
|
ext: ""
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Ensure latest Go is installed in /data/go
|
||||||
|
run: |
|
||||||
|
export GOROOT=/data/go/go
|
||||||
|
export PATH=$GOROOT/bin:$PATH
|
||||||
|
export GOCACHE=/data/gocache
|
||||||
|
export GOMODCACHE=/data/gomodcache
|
||||||
|
mkdir -p $GOCACHE $GOMODCACHE
|
||||||
|
|
||||||
|
if [ ! -x "$GOROOT/bin/go" ]; then
|
||||||
|
echo "Go not found in $GOROOT, downloading latest stable..."
|
||||||
|
|
||||||
|
GO_VERSION=$(curl -s https://go.dev/VERSION?m=text | head -n1)
|
||||||
|
echo "Latest version is $GO_VERSION"
|
||||||
|
|
||||||
|
mkdir -p /data/go
|
||||||
|
curl -sSL "https://go.dev/dl/${GO_VERSION}.linux-amd64.tar.gz" -o /tmp/go.tar.gz
|
||||||
|
tar -C /data/go -xzf /tmp/go.tar.gz
|
||||||
|
else
|
||||||
|
echo "Using cached Go from $GOROOT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
go version
|
||||||
|
|
||||||
|
- name: Download Go dependencies
|
||||||
|
run: |
|
||||||
|
export GOROOT=/data/go/go
|
||||||
|
export PATH=$GOROOT/bin:$PATH
|
||||||
|
export GOCACHE=/data/gocache
|
||||||
|
export GOMODCACHE=/data/gomodcache
|
||||||
|
mkdir -p $GOCACHE $GOMODCACHE
|
||||||
|
go mod download
|
||||||
|
|
||||||
|
- name: Build binary
|
||||||
|
run: |
|
||||||
|
export GOROOT=/data/go/go
|
||||||
|
export PATH=$GOROOT/bin:$PATH
|
||||||
|
export GOCACHE=/data/gocache
|
||||||
|
export GOMODCACHE=/data/gomodcache
|
||||||
|
mkdir -p $GOCACHE $GOMODCACHE
|
||||||
|
|
||||||
|
OUTPUT="bin/${APP_NAME}-${{ matrix.os }}-${{ matrix.arch }}"
|
||||||
|
if [ -n "${{ matrix.arm_version }}" ]; then
|
||||||
|
OUTPUT="${OUTPUT}v${{ matrix.arm_version }}"
|
||||||
|
export GOARM=${{ matrix.arm_version }}
|
||||||
|
fi
|
||||||
|
OUTPUT="${OUTPUT}${{ matrix.ext }}"
|
||||||
|
echo "Building $OUTPUT"
|
||||||
|
GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} go build -ldflags="-s -w" -trimpath -o "$OUTPUT"
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Upload artifact
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{ env.APP_NAME }}-${{ matrix.os }}-${{ matrix.arch }}
|
||||||
|
path: bin/
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1 +1,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
*.dbm
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# local executables
|
||||||
|
dbm-arm64
|
||||||
|
|||||||
51
args/args.go
51
args/args.go
@@ -3,34 +3,61 @@ package args
|
|||||||
import (
|
import (
|
||||||
"flag"
|
"flag"
|
||||||
|
|
||||||
"github.com/zuadi/tecamino-dbm/cert"
|
"gitea.tecamino.com/paadi/tecamino-dbm/cert"
|
||||||
"github.com/zuadi/tecamino-dbm/models"
|
"gitea.tecamino.com/paadi/tecamino-dbm/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// DBM cli arguments
|
||||||
type Args struct {
|
type Args struct {
|
||||||
|
Ip string
|
||||||
Port models.Port
|
Port models.Port
|
||||||
Cert cert.Cert
|
Cert cert.Cert
|
||||||
|
AllowOrigins []string
|
||||||
RootDir string
|
RootDir string
|
||||||
DMAFile string
|
DBMFile string
|
||||||
Debug bool
|
Debug bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// initialte cli arguments
|
||||||
func Init() *Args {
|
func Init() *Args {
|
||||||
|
|
||||||
|
var allowOrigins models.StringSlice
|
||||||
|
|
||||||
|
flag.Var(&allowOrigins, "allowOrigin", "Allowed origin (can repeat this flag)")
|
||||||
|
|
||||||
|
ip := flag.String("ip", "0.0.0.0", "local ip address")
|
||||||
|
organization := flag.String("org", "tecamino", "name of organization for certificate")
|
||||||
|
certFile := flag.String("certFile", "./cert/cert.pem", "path of certfile")
|
||||||
|
keyFile := flag.String("keyFile", "./cert/key.pem", "path of keyfile")
|
||||||
|
portHttp := flag.Uint("http-port", 8100, "json server communication for http/ws")
|
||||||
|
portHttps := flag.Uint("https-port", 8101, "json server communication for http/wss")
|
||||||
|
remotePort := flag.Uint("remotePort", 9500, "remote Port of gui user interface")
|
||||||
|
rootDir := flag.String("workingDir", "./", "working directory")
|
||||||
|
dbmFile := flag.String("dbm", "/test/test", "dbm file name")
|
||||||
|
debug := flag.Bool("debug", false, "debug flag")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
a := Args{
|
a := Args{
|
||||||
|
Ip: *ip,
|
||||||
Cert: cert.Cert{
|
Cert: cert.Cert{
|
||||||
Organization: *flag.String("org", "tecamino", "name of organization for certificate"),
|
Organization: *organization,
|
||||||
CertFile: *flag.String("certFile", "./cert/cert.pem", "path of certfile"),
|
CertFile: *certFile,
|
||||||
KeyFile: *flag.String("keyFile", "./cert/key.pem", "path of keyfile"),
|
KeyFile: *keyFile,
|
||||||
},
|
},
|
||||||
Port: models.Port{
|
Port: models.Port{
|
||||||
Http: *flag.Uint("http-port", 8100, "json server communication for http/ws"),
|
Http: *portHttp,
|
||||||
Https: *flag.Uint("https-port", 8101, "json server communication for http/wss"),
|
Https: *portHttps,
|
||||||
|
Remote: *remotePort,
|
||||||
},
|
},
|
||||||
RootDir: *flag.String("workingDir", "./", "working directory"),
|
RootDir: *rootDir,
|
||||||
DMAFile: *flag.String("dma", "/test/test", "dma file name"),
|
DBMFile: *dbmFile,
|
||||||
Debug: *flag.Bool("debug", false, "debug flag"),
|
Debug: *debug,
|
||||||
}
|
}
|
||||||
flag.Parse()
|
|
||||||
|
if len(allowOrigins) == 0 {
|
||||||
|
allowOrigins = models.StringSlice{"http://localhost:9500"}
|
||||||
|
}
|
||||||
|
|
||||||
|
a.AllowOrigins = allowOrigins
|
||||||
return &a
|
return &a
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,3 +13,11 @@ func GetIDFromAuth(c *gin.Context) (string, error) {
|
|||||||
}
|
}
|
||||||
return "", errors.New("authorization token missing")
|
return "", errors.New("authorization token missing")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetIDFromQuery(c *gin.Context) (string, error) {
|
||||||
|
auth, exists := c.GetQuery("id")
|
||||||
|
if !exists {
|
||||||
|
return "", errors.New("id missing")
|
||||||
|
}
|
||||||
|
return auth, nil
|
||||||
|
}
|
||||||
|
|||||||
24
cert/cert.go
24
cert/cert.go
@@ -29,11 +29,11 @@ func NewCertHandler(org string) *Cert {
|
|||||||
func (c *Cert) GenerateSelfSignedCert() error {
|
func (c *Cert) GenerateSelfSignedCert() error {
|
||||||
|
|
||||||
// do not generate certs if they exist
|
// do not generate certs if they exist
|
||||||
// _, err := os.Stat(c.CertFile)
|
_, err := os.Stat(c.CertFile)
|
||||||
// _, err2 := os.Stat(c.KeyFile)
|
_, err2 := os.Stat(c.KeyFile)
|
||||||
// if !os.IsNotExist(err) && !os.IsNotExist(err2) {
|
if !os.IsNotExist(err) && !os.IsNotExist(err2) {
|
||||||
// return nil
|
return nil
|
||||||
// }
|
}
|
||||||
|
|
||||||
priv, err := rsa.GenerateKey(rand.Reader, 2048)
|
priv, err := rsa.GenerateKey(rand.Reader, 2048)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -63,7 +63,7 @@ func (c *Cert) GenerateSelfSignedCert() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(path.Dir(c.CertFile)); os.IsNotExist(err) {
|
if _, err := os.Stat(path.Dir(c.CertFile)); os.IsNotExist(err) {
|
||||||
os.MkdirAll(path.Dir(c.CertFile), 0666)
|
os.MkdirAll(path.Dir(c.CertFile), 0700)
|
||||||
}
|
}
|
||||||
|
|
||||||
certOut, err := os.Create(c.CertFile)
|
certOut, err := os.Create(c.CertFile)
|
||||||
@@ -73,8 +73,13 @@ func (c *Cert) GenerateSelfSignedCert() error {
|
|||||||
defer certOut.Close()
|
defer certOut.Close()
|
||||||
pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: certDER})
|
pem.Encode(certOut, &pem.Block{Type: "CERTIFICATE", Bytes: certDER})
|
||||||
|
|
||||||
|
// Set permission to 0600 (read/write by owner only)
|
||||||
|
if err := os.Chmod(c.CertFile, 0600); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if _, err := os.Stat(path.Dir(c.KeyFile)); os.IsNotExist(err) {
|
if _, err := os.Stat(path.Dir(c.KeyFile)); os.IsNotExist(err) {
|
||||||
os.MkdirAll(path.Dir(c.KeyFile), 0666)
|
os.MkdirAll(path.Dir(c.KeyFile), 0700)
|
||||||
}
|
}
|
||||||
|
|
||||||
keyOut, err := os.Create(c.KeyFile)
|
keyOut, err := os.Create(c.KeyFile)
|
||||||
@@ -85,5 +90,10 @@ func (c *Cert) GenerateSelfSignedCert() error {
|
|||||||
|
|
||||||
pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)})
|
pem.Encode(keyOut, &pem.Block{Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(priv)})
|
||||||
|
|
||||||
|
// Set permission to 0600 (read/write by owner only)
|
||||||
|
if err := os.Chmod(c.KeyFile, 0600); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
27
dbm/db.go
Normal file
27
dbm/db.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) SaveData(c *gin.Context) {
|
||||||
|
s := time.Now()
|
||||||
|
if err := d.SaveDb(); err != nil {
|
||||||
|
r := json_dataModels.NewResponse()
|
||||||
|
r.SetError()
|
||||||
|
r.SetMessage(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
r := json_dataModels.NewResponse()
|
||||||
|
r.SetMessage(fmt.Sprintf("DBM %d datapoints saved in: %v", d.DBM.GetNumbersOfDatapoints(), time.Since(s)))
|
||||||
|
d.Log.Info("db.SaveData", fmt.Sprintf("DBM %d datapoints saved in: %v", d.DBM.GetNumbersOfDatapoints(), time.Since(s)))
|
||||||
|
c.JSON(http.StatusOK, r)
|
||||||
|
}
|
||||||
@@ -2,33 +2,33 @@ package dbm
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"context"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/tecamino/tecamino-logger/logging"
|
"gitea.tecamino.com/paadi/tecamino-dbm/args"
|
||||||
"github.com/zuadi/tecamino-dbm/args"
|
"gitea.tecamino.com/paadi/tecamino-dbm/models"
|
||||||
"github.com/zuadi/tecamino-dbm/models"
|
ws "gitea.tecamino.com/paadi/tecamino-dbm/websocket"
|
||||||
serverModels "github.com/zuadi/tecamino-dbm/server/models"
|
"gitea.tecamino.com/paadi/tecamino-logger/logging"
|
||||||
)
|
)
|
||||||
|
|
||||||
type DBMHandler struct {
|
type DBMHandler struct {
|
||||||
filePath string
|
DBM *models.DBM
|
||||||
DB models.Datapoint
|
Conns *ws.ClientHandler
|
||||||
Clients serverModels.Clients
|
|
||||||
sync.RWMutex
|
sync.RWMutex
|
||||||
Log *logging.Logger
|
Log *logging.Logger
|
||||||
arg *args.Args
|
arg *args.Args
|
||||||
|
filePath string
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialze new Database Manager
|
// initialze new Database Manager
|
||||||
// it will call cli arguments
|
// it will call cli arguments
|
||||||
func NewDbmHandler(a *args.Args) (*DBMHandler, error) {
|
func NewDbmHandler(a *args.Args) (*DBMHandler, error) {
|
||||||
|
|
||||||
|
//initialize new logger
|
||||||
logger, err := logging.NewLogger("dbmServer.log", &logging.Config{
|
logger, err := logging.NewLogger("dbmServer.log", &logging.Config{
|
||||||
MaxSize: 1,
|
MaxSize: 1,
|
||||||
MaxBackup: 3,
|
MaxBackup: 3,
|
||||||
@@ -40,14 +40,18 @@ func NewDbmHandler(a *args.Args) (*DBMHandler, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
logger.Info("main", "start dma")
|
logger.Info("main", "start dma handler")
|
||||||
|
|
||||||
|
//initialize connection map
|
||||||
|
conns := ws.NewConnectionHandler()
|
||||||
|
|
||||||
// Initialize dtabase manager handler
|
// Initialize dtabase manager handler
|
||||||
dmaHandler := DBMHandler{
|
dmaHandler := DBMHandler{
|
||||||
arg: a,
|
arg: a,
|
||||||
filePath: fmt.Sprintf("%s/%s.dma", a.RootDir, a.DMAFile),
|
filePath: fmt.Sprintf("%s/%s.dbm", a.RootDir, a.DBMFile),
|
||||||
|
DBM: models.NewDBM(conns, logger),
|
||||||
Log: logger,
|
Log: logger,
|
||||||
Clients: serverModels.NewClients(),
|
Conns: conns,
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize system datapoint and periodically update it
|
// initialize system datapoint and periodically update it
|
||||||
@@ -56,6 +60,7 @@ func NewDbmHandler(a *args.Args) (*DBMHandler, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check if dtabase file exists to load data
|
// check if dtabase file exists to load data
|
||||||
|
s := time.Now()
|
||||||
if _, err := os.Stat(dmaHandler.filePath); err == nil {
|
if _, err := os.Stat(dmaHandler.filePath); err == nil {
|
||||||
|
|
||||||
f, err := os.Open(dmaHandler.filePath)
|
f, err := os.Open(dmaHandler.filePath)
|
||||||
@@ -66,17 +71,20 @@ func NewDbmHandler(a *args.Args) (*DBMHandler, error) {
|
|||||||
|
|
||||||
// read in dtaabase file content
|
// read in dtaabase file content
|
||||||
scanner := bufio.NewScanner(f)
|
scanner := bufio.NewScanner(f)
|
||||||
|
var line int
|
||||||
for scanner.Scan() {
|
for scanner.Scan() {
|
||||||
dp := models.Datapoint{}
|
line++
|
||||||
err = json.Unmarshal(scanner.Bytes(), &dp)
|
dp := &models.Datapoint{}
|
||||||
if err != nil {
|
if err = json.Unmarshal(scanner.Bytes(), dp); err != nil {
|
||||||
|
dmaHandler.Log.Error("dmbHandler.NewDmbHandler", "error in line "+fmt.Sprint(line)+" "+scanner.Text())
|
||||||
|
dmaHandler.Log.Error("dmbHandler.NewDmbHandler", err.Error())
|
||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
dmaHandler.ImportDatapoints(&dp)
|
dmaHandler.DBM.ImportDatapoints(dp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
dmaHandler.Log.Info("dmbHandler.NewDmbHandler", fmt.Sprintf("%d datapoint imported in %v", dmaHandler.DBM.GetNumbersOfDatapoints(), time.Since(s)))
|
||||||
return &dmaHandler, nil
|
return &dmaHandler, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +95,13 @@ func (d *DBMHandler) SaveDb() (err error) {
|
|||||||
}
|
}
|
||||||
defer f.Close()
|
defer f.Close()
|
||||||
|
|
||||||
for _, dp := range d.DB.GetAllDatapoints(0) {
|
for _, dp := range d.DBM.GetAllDatapoints(0) {
|
||||||
|
//exclude System datapoints from saving
|
||||||
|
//System datapoints are used for internal purposes and should not be saved in the database
|
||||||
|
if strings.Contains(dp.Path, "System:") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
b, er := json.Marshal(dp)
|
b, er := json.Marshal(dp)
|
||||||
if er != nil {
|
if er != nil {
|
||||||
return er
|
return er
|
||||||
@@ -104,94 +118,3 @@ func (d *DBMHandler) SaveDb() (err error) {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DBMHandler) CreateDatapoint(typ models.Type, value any, right models.Rights, path string) error {
|
|
||||||
if err := d.DB.CreateDatapoint(typ, value, right, path); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
dp := d.QueryDatapoints(1, "System:Datapoints")
|
|
||||||
d.UpdateDatapointValue("System:Datapoints", dp[0].GetValueUint64()+1)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DBMHandler) ImportDatapoints(dps ...*models.Datapoint) error {
|
|
||||||
for _, dp := range dps {
|
|
||||||
err := d.DB.ImportDatapoint(dp, dp.Path)
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
dp := d.QueryDatapoints(1, "System:Datapoints")
|
|
||||||
d.UpdateDatapointValue("System:Datapoints", dp[0].GetValueUint64()+1)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DBMHandler) UpdateDatapointValue(path string, value any) error {
|
|
||||||
return d.DB.UpdateDatapointValue(value, path)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DBMHandler) RemoveDatapoint(path string) error {
|
|
||||||
if err := d.DB.RemoveDatapoint(path); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
dp := d.QueryDatapoints(1, "System:Datapoints")
|
|
||||||
d.UpdateDatapointValue("System:Datapoints", dp[0].GetValueUint64()+1)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DBMHandler) QueryDatapoints(depth int, key string) []*models.Datapoint {
|
|
||||||
return d.DB.QueryDatapoints(depth, key)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DBMHandler) AddSystemDps() (err error) {
|
|
||||||
tim := "System:Time"
|
|
||||||
memory := "System:UsedMemory"
|
|
||||||
var m runtime.MemStats
|
|
||||||
var mOld uint64
|
|
||||||
var tOld int64
|
|
||||||
|
|
||||||
err = d.DB.CreateDatapoint(models.LOU, 0, models.Read, "System:Datapoints")
|
|
||||||
if err != nil {
|
|
||||||
d.Log.Error("dmb.Handler.AddSystemDps.CreateDatapoint", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
err = d.DB.CreateDatapoint(models.STR, nil, models.Read, tim)
|
|
||||||
if err != nil {
|
|
||||||
d.Log.Error("dmb.Handler.AddSystemDps.CreateDatapoint", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
err = d.DB.CreateDatapoint(models.STR, nil, models.Read, memory)
|
|
||||||
if err != nil {
|
|
||||||
d.Log.Error("dmb.Handler.AddSystemDps.CreateDatapoint", err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
go func() {
|
|
||||||
|
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
for {
|
|
||||||
t := time.Now().UnixMilli()
|
|
||||||
if tOld != t {
|
|
||||||
if er := d.DB.UpdateDatapointValue(t, tim); er != nil {
|
|
||||||
d.Log.Error("dmb.Handler.AddSystemDps.UpdateDatapointValue", er.Error())
|
|
||||||
}
|
|
||||||
d.Publish(ctx, OnChange, tim, t)
|
|
||||||
tOld = t
|
|
||||||
}
|
|
||||||
runtime.ReadMemStats(&m)
|
|
||||||
if m.Sys != mOld {
|
|
||||||
mem := fmt.Sprintf("%.2f MB", float64(m.Sys)/1024/1024)
|
|
||||||
if er := d.DB.UpdateDatapointValue(mem, memory); er != nil {
|
|
||||||
d.Log.Error("dmb.Handler.AddSystemDps.UpdateDatapointValue", er.Error())
|
|
||||||
}
|
|
||||||
d.Publish(ctx, OnChange, memory, mem)
|
|
||||||
mOld = m.Sys
|
|
||||||
}
|
|
||||||
time.Sleep(1 * time.Second)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|||||||
40
dbm/get.go
Normal file
40
dbm/get.go
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
json_data "gitea.tecamino.com/paadi/tecamino-json_data"
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) Get(req *json_dataModels.Request, id string) {
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
} else if len(req.Get) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
d.RLock()
|
||||||
|
defer d.RUnlock()
|
||||||
|
|
||||||
|
resp := json_data.NewResponse()
|
||||||
|
resp.Id = req.Id
|
||||||
|
for _, get := range req.Get {
|
||||||
|
var depth uint = 1
|
||||||
|
if get.Query != nil {
|
||||||
|
depth = get.Query.Depth
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, dp := range d.DBM.QueryDatapoints(depth, get.Uuid, get.Path) {
|
||||||
|
resp.AddGet(json_dataModels.Get{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
Type: dp.Type,
|
||||||
|
Value: dp.Value,
|
||||||
|
HasChild: dp.Datapoints != nil,
|
||||||
|
Rights: dp.ReadWrite,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := d.Conns.SendResponse(id, resp); err != nil {
|
||||||
|
d.Log.Error("get.Get", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
84
dbm/json_data.go
Normal file
84
dbm/json_data.go
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
|
json_data "gitea.tecamino.com/paadi/tecamino-json_data"
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) Json_Data(c *gin.Context) {
|
||||||
|
|
||||||
|
var err error
|
||||||
|
payload, err := json_data.ParseRequest(c.Request.Body)
|
||||||
|
if err != nil {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.SetError()
|
||||||
|
r.SetMessage(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
resp := json_dataModels.NewResponse()
|
||||||
|
|
||||||
|
if len(payload.Get) > 0 {
|
||||||
|
var depth uint = 1
|
||||||
|
|
||||||
|
for _, get := range payload.Get {
|
||||||
|
if get.Query != nil {
|
||||||
|
depth = get.Query.Depth
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, res := range d.DBM.QueryDatapoints(depth, get.Uuid, get.Path) {
|
||||||
|
resp.AddGet(json_dataModels.Get{
|
||||||
|
Uuid: res.Uuid,
|
||||||
|
Path: res.Path,
|
||||||
|
Type: res.Type,
|
||||||
|
Value: res.Value,
|
||||||
|
Drivers: &res.Drivers,
|
||||||
|
HasChild: res.Datapoints != nil,
|
||||||
|
Rights: res.ReadWrite,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if len(payload.Set) > 0 {
|
||||||
|
resp.Set, err = d.DBM.CreateDatapoints(payload.Set...)
|
||||||
|
if err != nil {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.SetError()
|
||||||
|
r.SetMessage(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(200, resp)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBMHandler) Delete(c *gin.Context) {
|
||||||
|
var err error
|
||||||
|
payload, err := json_data.ParseRequest(c.Request.Body)
|
||||||
|
if err != nil {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.SetError()
|
||||||
|
r.SetMessage(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
response := json_data.NewResponse()
|
||||||
|
if payload.Set != nil {
|
||||||
|
response.Set, err = d.DBM.RemoveDatapoint(payload.Set...)
|
||||||
|
if err != nil {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.SetError()
|
||||||
|
r.SetMessage(err.Error())
|
||||||
|
c.JSON(http.StatusBadRequest, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
c.JSON(200, response)
|
||||||
|
}
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
package dbm
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
|
|
||||||
"github.com/coder/websocket/wsjson"
|
|
||||||
"github.com/zuadi/tecamino-dbm/models"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (d *DBMHandler) Publish(ctx context.Context, eventType, path string, value any) error {
|
|
||||||
d.RLock()
|
|
||||||
defer d.RUnlock()
|
|
||||||
|
|
||||||
for _, dp := range d.DB.QueryDatapoints(1, path) {
|
|
||||||
for id, pub := range dp.Subscribtions {
|
|
||||||
if client, ok := d.Clients[id]; !ok {
|
|
||||||
delete(dp.Subscribtions, id)
|
|
||||||
} else {
|
|
||||||
if pub.OnChange {
|
|
||||||
err := wsjson.Write(ctx, client.Conn, models.JsonResponse{
|
|
||||||
Event: OnChange,
|
|
||||||
Path: dp.Path,
|
|
||||||
Value: value,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
d.Log.Error("publish.Publish", err.Error())
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
46
dbm/set.go
Normal file
46
dbm/set.go
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) Set(req *json_dataModels.Request, id string) {
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
} else if len(req.Set) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
d.RLock()
|
||||||
|
defer d.RUnlock()
|
||||||
|
|
||||||
|
resp := json_dataModels.NewResponse()
|
||||||
|
resp.Id = req.Id
|
||||||
|
|
||||||
|
for _, set := range req.Set {
|
||||||
|
dps := d.DBM.QueryDatapoints(1, set.Uuid, set.Path)
|
||||||
|
|
||||||
|
if len(dps) == 0 {
|
||||||
|
resp.SetError()
|
||||||
|
if resp.Message == "" {
|
||||||
|
resp.SetMessage(fmt.Sprintf("datapoint %s not found", set.Path))
|
||||||
|
}
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, dp := range dps {
|
||||||
|
dp.UpdateValue(set.Value)
|
||||||
|
|
||||||
|
resp.AddSet(json_dataModels.Set{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
Value: dp.Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := d.Conns.SendResponse(id, resp); err != nil {
|
||||||
|
d.Log.Error("get.Set", err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,46 +1,98 @@
|
|||||||
package dbm
|
package dbm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/coder/websocket/wsjson"
|
"fmt"
|
||||||
"github.com/zuadi/tecamino-dbm/models"
|
|
||||||
"golang.org/x/net/context"
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (d *DBMHandler) Subscribe(ctx context.Context, sub *models.Subscribe, id string) {
|
func (d *DBMHandler) Subscribe(req *json_dataModels.Request, id string) {
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(req.Subscribe) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
d.RLock()
|
d.RLock()
|
||||||
defer d.RUnlock()
|
defer d.RUnlock()
|
||||||
|
|
||||||
for _, dp := range d.DB.QueryDatapoints(sub.Depth, sub.Path) {
|
resp := json_dataModels.NewResponse()
|
||||||
if sub.Driver != nil {
|
resp.Id = req.Id
|
||||||
if dp.Drivers == nil {
|
|
||||||
|
for _, sub := range req.Subscribe {
|
||||||
|
dps := d.DBM.QueryDatapoints(sub.Depth, sub.Uuid, sub.Path)
|
||||||
|
|
||||||
|
if len(dps) == 0 {
|
||||||
|
resp.SetError()
|
||||||
|
if resp.Message == "" {
|
||||||
|
resp.SetMessage(fmt.Sprintf("datapoint %s not found", sub.Path))
|
||||||
|
}
|
||||||
continue
|
continue
|
||||||
} else if _, ok := dp.Drivers[*sub.Driver]; !ok {
|
}
|
||||||
|
|
||||||
|
for _, dp := range dps {
|
||||||
|
if sub.Driver != "" {
|
||||||
|
if dp.Drivers == nil || dp.Drivers[sub.Driver] == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dp.AddSubscribtion(id, sub)
|
client := d.DBM.Conns.GetClient(id)
|
||||||
|
if client == nil {
|
||||||
|
d.Log.Warning("subscribe", "id "+id+" not found")
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
err := wsjson.Write(ctx, d.Clients[id].Conn, models.JsonResponse{
|
dp.AddSubscribtion(client, sub)
|
||||||
Event: OnCreate,
|
resp.AddSubscription(json_dataModels.Subscription{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
Path: dp.Path,
|
Path: dp.Path,
|
||||||
Value: dp.Value,
|
Value: dp.Value,
|
||||||
|
HasChild: dp.Datapoints != nil,
|
||||||
|
Rights: dp.ReadWrite.GetRights(),
|
||||||
|
Driver: sub.Driver,
|
||||||
|
Drivers: &dp.Drivers,
|
||||||
})
|
})
|
||||||
if err != nil {
|
}
|
||||||
|
}
|
||||||
|
if err := d.Conns.SendResponse(id, resp); err != nil {
|
||||||
d.Log.Error("subscribe.Subscribe", err.Error())
|
d.Log.Error("subscribe.Subscribe", err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DBMHandler) Unsubscribe(ctx context.Context, sub *models.Subscribe, id string) error {
|
func (d *DBMHandler) Unsubscribe(req *json_dataModels.Request, id string) {
|
||||||
|
if req == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if len(req.Unsubscribe) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
d.RLock()
|
d.RLock()
|
||||||
defer d.RUnlock()
|
defer d.RUnlock()
|
||||||
|
|
||||||
for _, dp := range d.DB.QueryDatapoints(sub.Depth, sub.Path) {
|
resp := json_dataModels.NewResponse()
|
||||||
if _, ok := dp.Subscribtions[id]; !ok {
|
resp.Id = req.Id
|
||||||
|
|
||||||
|
for _, sub := range req.Unsubscribe {
|
||||||
|
for _, dp := range d.DBM.QueryDatapoints(sub.Depth, sub.Uuid, sub.Path) {
|
||||||
|
|
||||||
|
client := d.DBM.Conns.GetClient(id)
|
||||||
|
if client == nil {
|
||||||
|
d.Log.Warning("subscribe", "id "+id+" not found")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
dp.RemoveSubscribtion(id)
|
|
||||||
|
if _, ok := dp.Subscriptions[client]; !ok {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
dp.RemoveSubscribtion(client)
|
||||||
|
resp.AddUnsubscription(json_dataModels.Subscription{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := d.Conns.SendResponse(id, resp); err != nil {
|
||||||
|
d.Log.Error("subscribe.Unsubscribe", err.Error())
|
||||||
}
|
}
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
29
dbm/system.go
Normal file
29
dbm/system.go
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
package dbm
|
||||||
|
|
||||||
|
import (
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-dbm/models"
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (d *DBMHandler) AddSystemDps() (err error) {
|
||||||
|
path := "System:Datapoints"
|
||||||
|
|
||||||
|
typ := json_dataModels.LOU
|
||||||
|
rights := json_dataModels.Read
|
||||||
|
_, err = d.DBM.CreateDatapoints(json_dataModels.Set{Path: path, Value: 0, Type: typ, Rights: rights})
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("dmb.Handler.AddSystemDps", err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
models.SystemDatapoints = d.DBM.QueryDatapoints(1, uuid.Nil, path)[0].Uuid
|
||||||
|
|
||||||
|
if err = d.DBM.GoSystemTime(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = d.DBM.GoSystemMemory(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
@@ -1,13 +1,11 @@
|
|||||||
package dbm
|
package dbm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/coder/websocket"
|
"gitea.tecamino.com/paadi/tecamino-dbm/auth"
|
||||||
"github.com/coder/websocket/wsjson"
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zuadi/tecamino-dbm/models"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -17,75 +15,47 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (d *DBMHandler) WebSocket(c *gin.Context) {
|
func (d *DBMHandler) WebSocket(c *gin.Context) {
|
||||||
// id, err := auth.GetIDFromAuth(c)
|
id, err := auth.GetIDFromQuery(c)
|
||||||
// if err != nil {
|
|
||||||
// d.Log.Error("dbmHandler.webSocket.Websocket", "error GetIDFromAuth: "+err.Error())
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
id := "test"
|
|
||||||
|
|
||||||
d.Log.Debug("dbmHandler.webSocket.Websocket", "authorization id token: "+id)
|
|
||||||
|
|
||||||
ctx, cancel := context.WithCancel(c.Request.Context())
|
|
||||||
defer cancel()
|
|
||||||
err := d.Clients.ConnectRecievingWsConnection(id, c)
|
|
||||||
defer d.Clients.RemoveClient(id)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
d.Log.Error("dbmHandler.webSocket.Websocket", "error connecting recieving websocket conection: "+err.Error())
|
d.Log.Error("dbmHandler.webSocket.Websocket", "error GetIDFromQuery: "+err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
defer d.Clients.DisconnectWsConnection(id, websocket.StatusInternalError, "Internal error")
|
d.Log.Debug("dbmHandler.webSocket.Websocket", "authorization id token: "+id)
|
||||||
|
|
||||||
//Read loop
|
client, err := d.Conns.ConnectNewClient(id, c)
|
||||||
for {
|
|
||||||
request, err := d.readJsonData(ctx, id)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
d.Log.Error("dbmHandler.webSocket.Websocket", err)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.OnMessage = func(data []byte) {
|
||||||
|
request, err := d.readJsonData(data)
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("dbmHandler.webSocket.Websocket", "read json: "+err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sets
|
||||||
|
d.Get(request, id)
|
||||||
|
// Sets
|
||||||
|
d.Set(request, id)
|
||||||
|
|
||||||
// Subscribe
|
// Subscribe
|
||||||
|
d.Subscribe(request, id)
|
||||||
if request.Subscribe != nil {
|
|
||||||
go func() {
|
|
||||||
for _, sub := range *request.Subscribe {
|
|
||||||
d.Subscribe(ctx, &sub, id)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Unsubscribe
|
// Unsubscribe
|
||||||
if request.Unsubscribe != nil {
|
d.Unsubscribe(request, id)
|
||||||
for _, unsub := range *request.Unsubscribe {
|
|
||||||
err = d.Unsubscribe(ctx, &unsub, id)
|
|
||||||
if err != nil {
|
|
||||||
d.Log.Error("dbmHandler.WebSocket unsubscribe", err)
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
client.OnWarning = func(s string) {
|
||||||
|
d.Log.Warning("dbmHandler.webSocket.Websocket", "warning on websocket connection: "+s)
|
||||||
|
}
|
||||||
|
|
||||||
|
client.OnError = func(err error) {
|
||||||
|
d.Log.Error("dbmHandler.webSocket.Websocket", "error on websocket connection: "+err.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
func (d *DBMHandler) readJsonData(data []byte) (request *json_dataModels.Request, err error) {
|
||||||
break
|
err = json.Unmarshal(data, &request)
|
||||||
}
|
return
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *DBMHandler) readJsonData(ctx context.Context, id string) (*models.JsonData, error) {
|
|
||||||
var request models.JsonData
|
|
||||||
err := wsjson.Read(ctx, d.Clients[id].Conn, &request)
|
|
||||||
if err != nil {
|
|
||||||
code := websocket.CloseStatus(err)
|
|
||||||
|
|
||||||
switch code {
|
|
||||||
case websocket.StatusNormalClosure,
|
|
||||||
websocket.StatusGoingAway,
|
|
||||||
websocket.StatusNoStatusRcvd:
|
|
||||||
d.Log.Info("webSocket.readJsonData", fmt.Sprintf("WebSocket closed: %v (code: %v)\n", err, code))
|
|
||||||
return nil, err
|
|
||||||
default:
|
|
||||||
d.Log.Error("webSocket.readJsonData", fmt.Sprintf("WebSocket read error: %v (code: %v)\n", err, code))
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return &request, nil
|
|
||||||
}
|
}
|
||||||
|
|||||||
560
dbmServer.log
560
dbmServer.log
@@ -1,560 +0,0 @@
|
|||||||
{"level":"info","timestamp":"2025-04-23T08:02:12.084","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:02:12.348","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:02:12.348","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:02:12.348","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:02:12.566","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:02:13.834","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:02:14.031","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:03:55.063","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:03:55.346","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:03:55.347","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:03:55.347","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:03:55.554","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:03:56.853","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:03:57.041","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:05:18.061","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:05:18.332","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:05:18.332","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:05:18.332","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:05:18.538","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:05:19.842","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:05:21.010","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:06:19.179","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:06:19.439","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:06:19.439","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:06:19.439","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:06:19.617","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:06:20.861","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:07:45.597","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:07:45.879","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:07:45.879","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:07:45.879","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:07:46.160","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:07:47.447","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:08:23.028","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:08:23.295","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:08:23.296","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:08:23.296","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:08:23.474","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:08:24.714","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:09:06.062","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:09:06.326","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:09:06.326","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:09:06.326","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:09:06.534","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:09:07.841","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:09:08.005","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:09:29.794","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:09:30.036","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:09:30.037","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:09:30.037","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:09:30.208","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:09:31.467","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:10:00.754","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:10:01.044","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:10:01.045","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:10:01.045","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:10:01.248","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:10:02.507","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:11:50.298","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:11:50.570","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:11:50.570","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:11:50.570","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:11:50.768","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:11:52.046","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:11:52.222","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:14:17.351","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:14:48.221","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:15:28.790","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:16:02.029","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:16:02.037","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:16:02.037","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:16:02.037","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:16:02.037","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:16:03.038","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:16:04.038","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:16:05.038","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:17:30.755","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:17:30.765","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:17:30.765","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:17:30.765","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:17:30.766","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:17:31.767","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:17:31.768","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:17:32.768","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:17:33.770","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:18:37.367","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:18:37.374","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:18:37.374","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:18:37.374","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:18:37.375","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:18:38.376","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:18:38.377","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:19:02.577","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:19:02.584","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:19:02.585","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:19:02.585","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:19:02.586","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:19:03.588","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:22:01.802","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:22:01.809","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:22:01.809","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:22:01.809","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:22:01.809","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:22:02.811","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:22:02.811","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:23:09.752","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:23:09.759","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:23:09.759","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:23:09.759","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:23:09.760","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:23:10.762","msg":"datapoint 'System:Time' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:23:10.763","msg":"datapoint 'System:UsedMemory' not found","caller":"dmb.Handler.AddSystemDps.UpdateDatapointValue"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:24:46.880","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:24:46.889","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:24:46.889","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:25:26.842","msg":"error GetIDFromAuth: authorization token missing","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:25:35.344","msg":"error GetIDFromAuth: authorization token missing","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:26:04.855","msg":"error GetIDFromAuth: authorization token missing","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:26:53.623","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:26:53.630","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:26:53.630","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:26:57.252","msg":"error GetIDFromAuth: authorization token missing","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:28:05.758","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:28:05.765","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:28:05.765","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:28:22.491","msg":"error GetIDFromAuth: authorization token missing","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:36:30.757","msg":"error GetIDFromAuth: authorization token missing","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:37:09.352","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:37:09.360","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:37:09.360","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:38:28.101","msg":"read error:failed to read JSON message: failed to get reader: use of closed network connection","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:38:34.491","msg":"read error:failed to read JSON message: failed to get reader: use of closed network connection","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:38:36.178","msg":"read error:failed to read JSON message: failed to get reader: use of closed network connection","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:38:37.265","msg":"read error:failed to read JSON message: failed to get reader: use of closed network connection","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:39:48.364","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:39:48.371","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:39:48.371","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:39:52.813","msg":"read error:failed to read JSON message: failed to unmarshal JSON: invalid character ':' after array element","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:39:56.608","msg":"read error:failed to read JSON message: failed to unmarshal JSON: invalid character ':' after array element","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:41:31.574","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:41:31.582","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:41:31.582","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:42:38.600","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:42:38.607","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:42:38.607","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:43:56.663","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:43:56.669","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:43:56.669","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:44:19.860","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:44:19.868","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:44:19.868","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:46:59.540","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:46:59.548","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T08:46:59.548","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T08:48:07.605","msg":"read error:failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\"","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:36:14.713","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:36:14.720","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:36:14.720","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:38:52.202","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:38:52.209","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:38:52.209","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:41:53.037","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:41:53.044","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:41:53.044","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:43:35.980","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:43:35.986","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:43:35.986","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T09:44:07.385","msg":"read error:failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\"","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:45:56.213","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:45:56.221","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:45:56.221","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:47:40.184","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:47:40.193","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T09:47:40.193","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:05:31.052","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:05:31.304","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:05:31.304","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:12:24.313","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:12:24.571","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:12:24.571","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T12:20:28.805","msg":"read error:failed to read JSON message: failed to get reader: use of closed network connection","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T12:20:48.504","msg":"read error:failed to read JSON message: failed to get reader: use of closed network connection","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T12:22:08.000","msg":"read error:failed to read JSON message: failed to get reader: use of closed network connection","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T12:24:00.791","msg":"read error:failed to read JSON message: failed to get reader: use of closed network connection","caller":"artNet.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:24:25.263","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:24:25.517","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:24:25.517","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:42:11.099","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:42:11.364","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:42:11.364","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T12:45:18.145","msg":"read error:failed to read JSON message: failed to get reader: context deadline exceeded","caller":"dbmHandler.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T12:48:43.020","msg":"read error:failed to read JSON message: failed to get reader: context deadline exceeded","caller":"dbmHandler.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:49:40.208","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:49:40.486","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:49:40.486","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:55:05.401","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:55:05.671","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T12:55:05.671","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T12:58:11.602","msg":"read error:failed to read JSON message: failed to get reader: context deadline exceeded","caller":"dbmHandler.webSocket.Websocket"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T13:08:06.888","msg":"read error:failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\"","caller":"dbmHandler.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:09:04.736","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:09:05.042","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:09:05.042","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T13:09:10.775","msg":"read error:failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\"","caller":"dbmHandler.webSocket.Websocket"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:22:27.316","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:22:27.673","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:22:27.673","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:22:48.485","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T13:23:26.354","msg":"failed to write JSON message: failed to marshal JSON: failed to write msg: use of closed network connection","caller":"publish.Publish"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:23:40.800","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:23:41.121","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:23:41.121","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:23:45.546","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:26:22.134","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:26:22.395","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:26:22.396","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:26:27.705","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:28:49.207","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:28:49.481","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:28:49.481","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:28:54.557","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T13:28:56.630","msg":"WebSocket read error: failed to read JSON message: failed to get reader: use of closed network connection (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T13:28:58.939","msg":"WebSocket read error: failed to read JSON message: failed to get reader: use of closed network connection (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T13:29:00.193","msg":"WebSocket read error: failed to read JSON message: failed to get reader: use of closed network connection (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:29:48.517","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:29:48.779","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:29:48.779","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:29:55.335","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:30:20.462","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:30:20.783","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:30:20.783","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:30:28.263","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:30:36.849","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:38:08.451","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:38:08.756","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:38:08.756","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:39:36.799","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:39:37.075","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:39:37.075","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:40:44.651","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:40:44.973","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:40:44.973","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:41:54.047","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:41:54.352","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:41:54.352","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:54:32.110","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:54:32.407","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:54:32.408","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:55:49.618","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:55:49.900","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:55:49.900","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:56:34.529","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:56:34.860","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:56:34.860","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:57:00.522","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:57:00.823","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:57:00.823","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:57:22.103","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:57:22.367","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T13:57:22.367","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:05.868","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:06.135","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:06.135","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:29.804","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:30.055","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:30.055","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:39.419","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:39.753","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:00:39.753","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:01:26.135","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:01:26.431","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:01:26.431","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:02:07.851","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:02:08.136","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:02:08.136","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:02:36.620","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:02:36.922","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:02:36.922","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:03:44.025","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:03:44.292","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:03:44.292","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:04:32.978","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:05:24.731","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:05:25.011","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:05:25.011","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:06:00.079","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:06:06.589","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:06:46.334","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:06:46.629","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:06:46.629","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:09:01.329","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:09:01.638","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:09:01.638","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:11:10.493","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:11:10.793","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:11:10.798","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:14:33.137","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:14:33.407","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:14:33.407","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:16:47.484","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:16:47.778","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:16:47.778","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:18:29.845","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:18:30.159","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:18:30.159","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:19:09.524","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:19:09.847","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:19:09.847","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:21:05.124","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:21:05.395","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:21:05.395","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:21:38.789","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:21:39.079","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:21:39.079","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:22:02.321","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:22:02.597","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:22:02.598","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:22:17.086","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:22:17.405","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:22:17.405","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:24:08.156","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:24:08.431","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:24:08.431","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:41:40.222","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:41:40.522","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:41:40.522","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:42:33.463","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:42:33.816","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:42:33.816","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:42:55.048","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:42:55.333","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:42:55.333","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:44:23.194","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:44:23.478","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:44:23.478","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:48:31.721","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:48:32.003","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:48:32.003","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:50:44.138","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:50:44.434","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:50:44.434","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:52:27.355","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:52:27.657","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T14:52:27.657","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:13:04.232","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:13:04.511","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:13:04.511","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:14:14.199","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:14:14.529","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:14:14.529","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:14:47.927","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:14:48.213","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:14:48.213","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:15:55.558","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:15:55.856","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:15:55.856","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:18:06.585","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:18:06.896","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:18:06.896","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:19:48.203","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:19:48.560","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:19:48.560","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:21:47.452","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:21:47.731","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:21:47.731","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:22:26.167","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:22:26.453","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:22:26.453","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:24:30.840","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:24:31.154","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:24:31.154","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:25:21.097","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:25:21.448","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:25:21.448","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:26:19.462","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:26:19.770","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:26:19.770","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:27:56.148","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:27:56.425","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:27:56.425","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:29:19.768","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:29:20.055","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:29:20.055","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:30:37.990","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:30:38.306","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:30:38.306","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:33:04.614","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:33:04.872","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:33:04.872","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:33:42.125","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:33:42.405","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:33:42.405","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:35:29.364","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:35:29.645","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:35:29.645","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:36:27.148","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:36:27.439","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:36:27.439","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:37:26.182","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:37:26.468","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:37:26.468","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:39:44.950","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:39:45.259","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:39:45.259","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:42:56.735","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:42:57.000","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:42:57.000","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:44:07.340","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:44:07.617","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:44:07.617","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:49:39.704","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:49:40.013","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:49:40.013","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:50:33.848","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:50:58.614","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:51:15.662","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:51:29.317","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T15:51:37.704","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:08:38.719","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:09:00.713","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:09:01.005","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:09:01.005","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:13:13.940","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:13:14.214","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:13:14.214","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:15:14.715","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:15:15.003","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:15:15.003","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:15:44.461","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:15:44.726","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:15:44.726","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:16:37.294","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:16:37.634","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:16:37.634","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:17:12.883","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:17:13.188","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:17:13.188","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:17:36.481","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:17:36.753","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:17:36.753","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:18:35.785","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:18:36.060","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:18:36.060","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:19:18.201","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:19:18.472","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:19:18.472","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:20:00.617","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:20:00.931","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:20:00.931","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:20:29.238","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:20:29.523","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:20:29.523","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:21:12.711","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:21:12.995","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:21:12.995","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:21:46.808","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:21:47.089","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:21:47.089","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:24:34.513","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:24:34.766","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:24:34.767","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:25:08.863","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:25:09.125","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:25:09.125","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:25:20.500","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:25:20.758","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:25:20.758","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:26:35.367","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:26:35.640","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:26:35.640","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:27:24.719","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:27:25.026","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:27:25.026","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:28:45.695","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:28:45.978","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:28:45.978","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:33:31.621","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:33:31.908","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:33:31.908","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:40:29.559","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:40:29.827","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:40:29.827","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:40:54.193","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:40:54.523","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:40:54.525","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:41:50.625","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:42:41.188","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:42:41.483","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:42:41.483","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:43:26.920","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:43:27.222","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:43:27.222","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:43:46.937","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:43:47.210","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:43:47.211","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:43:57.348","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:44:18.299","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:44:18.584","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:44:18.584","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:47:28.208","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:47:28.525","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:47:28.525","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:55:08.835","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:55:09.098","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:55:09.098","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:56:37.960","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:56:38.242","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:56:38.242","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:58:01.228","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:58:01.513","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:58:01.513","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:59:20.426","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:59:20.707","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T16:59:20.707","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:12:15.307","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:12:16.391","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:12:16.391","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:13:58.319","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:14:39.566","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:14:40.644","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:14:40.644","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:15:48.856","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:15:50.428","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:15:50.428","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:16:59.161","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:17:54.578","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:17:55.858","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:17:55.858","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:19:30.348","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T17:19:30.348","msg":"failed to write JSON message: failed to marshal JSON: failed to write msg: use of closed network connection","caller":"subscribe.Subscribe"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:19:43.223","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:19:44.757","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:19:44.757","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"error","timestamp":"2025-04-23T17:20:07.653","msg":"WebSocket read error: failed to read JSON message: failed to unmarshal JSON: invalid character ',' looking for beginning of value (code: StatusCode(-1))\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:20:17.815","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusNoStatusRcvd and reason = \"\" (code: StatusNoStatusRcvd)\n","caller":"webSocket.readJsonData"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:22:06.954","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:22:08.494","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:22:08.494","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:22:49.284","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:22:50.545","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:22:50.545","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:23:21.885","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:23:23.201","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:23:23.201","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:24:20.189","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:24:21.524","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:24:21.524","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:31:09.915","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:31:10.999","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:31:10.999","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:31:48.721","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:31:49.832","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:31:49.832","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:33:31.847","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:33:32.898","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:33:32.898","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:35:01.005","msg":"start dma","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:35:02.192","msg":"https listen on 8101","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:35:02.192","msg":"http listen on 8100","caller":"main"}
|
|
||||||
{"level":"info","timestamp":"2025-04-23T17:36:14.186","msg":"WebSocket closed: failed to read JSON message: failed to get reader: received close frame: status = StatusGoingAway and reason = \"\" (code: StatusGoingAway)\n","caller":"webSocket.readJsonData"}
|
|
||||||
@@ -3,5 +3,8 @@ package drivers
|
|||||||
type Drivers []Driver
|
type Drivers []Driver
|
||||||
|
|
||||||
type Driver interface {
|
type Driver interface {
|
||||||
|
NewArtNetDriver(string)
|
||||||
AddAddress()
|
AddAddress()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//func Add
|
||||||
|
|||||||
40
go.mod
40
go.mod
@@ -1,41 +1,43 @@
|
|||||||
module github.com/zuadi/tecamino-dbm
|
module gitea.tecamino.com/paadi/tecamino-dbm
|
||||||
|
|
||||||
go 1.24.0
|
go 1.24.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/coder/websocket v1.8.13
|
gitea.tecamino.com/paadi/tecamino-json_data v0.1.0
|
||||||
|
gitea.tecamino.com/paadi/tecamino-logger v0.2.1
|
||||||
|
github.com/gin-contrib/cors v1.7.5
|
||||||
github.com/gin-gonic/gin v1.10.0
|
github.com/gin-gonic/gin v1.10.0
|
||||||
github.com/tecamino/tecamino-logger v0.2.0
|
github.com/google/uuid v1.6.0
|
||||||
golang.org/x/net v0.25.0
|
github.com/gorilla/websocket v1.5.3
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bytedance/sonic v1.11.6 // indirect
|
github.com/bytedance/sonic v1.13.2 // indirect
|
||||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
github.com/bytedance/sonic/loader v0.2.4 // indirect
|
||||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
github.com/cloudwego/base64x v0.1.5 // indirect
|
||||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
github.com/gabriel-vasile/mimetype v1.4.8 // indirect
|
||||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
github.com/gin-contrib/sse v1.0.0 // indirect
|
||||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
|
||||||
github.com/go-playground/locales v0.14.1 // indirect
|
github.com/go-playground/locales v0.14.1 // indirect
|
||||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
github.com/go-playground/validator/v10 v10.26.0 // indirect
|
||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.5 // indirect
|
||||||
github.com/json-iterator/go v1.1.12 // indirect
|
github.com/json-iterator/go v1.1.12 // indirect
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
|
||||||
github.com/leodido/go-urn v1.4.0 // indirect
|
github.com/leodido/go-urn v1.4.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||||
go.uber.org/multierr v1.10.0 // indirect
|
go.uber.org/multierr v1.10.0 // indirect
|
||||||
go.uber.org/zap v1.27.0 // indirect
|
go.uber.org/zap v1.27.0 // indirect
|
||||||
golang.org/x/arch v0.8.0 // indirect
|
golang.org/x/arch v0.15.0 // indirect
|
||||||
golang.org/x/crypto v0.23.0 // indirect
|
golang.org/x/crypto v0.36.0 // indirect
|
||||||
golang.org/x/sys v0.20.0 // indirect
|
golang.org/x/net v0.38.0 // indirect
|
||||||
golang.org/x/text v0.15.0 // indirect
|
golang.org/x/sys v0.31.0 // indirect
|
||||||
google.golang.org/protobuf v1.34.1 // indirect
|
golang.org/x/text v0.23.0 // indirect
|
||||||
|
google.golang.org/protobuf v1.36.6 // indirect
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
|
||||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
90
go.sum
90
go.sum
@@ -1,20 +1,24 @@
|
|||||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
gitea.tecamino.com/paadi/tecamino-json_data v0.1.0 h1:zp3L8qUvkVqzuesQdMh/SgZZZbX3pGD9NYa6jtz+JvA=
|
||||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
gitea.tecamino.com/paadi/tecamino-json_data v0.1.0/go.mod h1:/FKhbVYuhiNlQp4552rJJQIhynjLarDzfrgXpupkwZU=
|
||||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
gitea.tecamino.com/paadi/tecamino-logger v0.2.1 h1:sQTBKYPdzn9mmWX2JXZBtGBvNQH7cuXIwsl4TD0aMgE=
|
||||||
|
gitea.tecamino.com/paadi/tecamino-logger v0.2.1/go.mod h1:FkzRTldUBBOd/iy2upycArDftSZ5trbsX5Ira5OzJgM=
|
||||||
|
github.com/bytedance/sonic v1.13.2 h1:8/H1FempDZqC4VqjptGo14QQlJx8VdZJegxs6wwfqpQ=
|
||||||
|
github.com/bytedance/sonic v1.13.2/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
|
||||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
|
||||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
|
||||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
|
||||||
|
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||||
github.com/coder/websocket v1.8.13 h1:f3QZdXy7uGVz+4uCJy2nTZyM0yTBj8yANEHhqlXZ9FE=
|
|
||||||
github.com/coder/websocket v1.8.13/go.mod h1:LNVeNrXQZfe5qhS9ALED3uA+l5pPqvwXg3CKoDBB2gs=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
github.com/gabriel-vasile/mimetype v1.4.8 h1:FfZ3gj38NjllZIeJAmMhr+qKL8Wu+nOoI3GqacKw1NM=
|
||||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
github.com/gabriel-vasile/mimetype v1.4.8/go.mod h1:ByKUIKGjh1ODkGM1asKUbQZOLGrPjydw3hYPU2YU9t8=
|
||||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
github.com/gin-contrib/cors v1.7.5 h1:cXC9SmofOrRg0w9PigwGlHG3ztswH6bqq4vJVXnvYMk=
|
||||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
github.com/gin-contrib/cors v1.7.5/go.mod h1:4q3yi7xBEDDWKapjT2o1V7mScKDDr8k+jZ0fSquGoy0=
|
||||||
|
github.com/gin-contrib/sse v1.0.0 h1:y3bT1mUWUxDpW4JLQg/HnTqV4rozuW4tC9eFKTxYI9E=
|
||||||
|
github.com/gin-contrib/sse v1.0.0/go.mod h1:zNuFdwarAygJBht0NTKiSi3jRf6RbqeILZ9Sp6Slhe0=
|
||||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||||
@@ -23,19 +27,27 @@ github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/o
|
|||||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
|
||||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
|
||||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
|
||||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
|
||||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||||
|
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||||
|
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||||
|
github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg=
|
||||||
|
github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
|
||||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
|
||||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||||
|
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
|
||||||
|
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
|
||||||
|
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||||
|
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
@@ -45,10 +57,12 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
|
|||||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
|
github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8=
|
||||||
|
github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||||
@@ -59,10 +73,8 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/
|
|||||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/tecamino/tecamino-logger v0.2.0 h1:NPH/Gg9qRhmVoW8b39i1eXu/LEftHc74nyISpcRG+XU=
|
|
||||||
github.com/tecamino/tecamino-logger v0.2.0/go.mod h1:0M1E9Uei/qw3e3WA1x3lBo1eP3H5oeYE7GjYrMahnj8=
|
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||||
@@ -73,29 +85,27 @@ go.uber.org/multierr v1.10.0 h1:S0h4aNzvfcFsC3dRF1jLoaov7oRaKqRGC/pUEJ2yvPQ=
|
|||||||
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
go.uber.org/multierr v1.10.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y=
|
||||||
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8=
|
||||||
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
|
||||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw=
|
||||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE=
|
||||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34=
|
||||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc=
|
||||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
|
||||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
|
||||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
|
||||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik=
|
||||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
|
||||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||||
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
|
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
|
||||||
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
|
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||||
|
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc=
|
||||||
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc=
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
|
||||||
|
|||||||
29
main.go
29
main.go
@@ -3,45 +3,52 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-dbm/args"
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-dbm/dbm"
|
||||||
|
ws "gitea.tecamino.com/paadi/tecamino-dbm/websocket"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
"github.com/zuadi/tecamino-dbm/args"
|
|
||||||
"github.com/zuadi/tecamino-dbm/dbm"
|
|
||||||
"github.com/zuadi/tecamino-dbm/server"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// cli arguments
|
// cli arguments
|
||||||
a := args.Init()
|
a := args.Init()
|
||||||
|
|
||||||
|
// initiate new database manger
|
||||||
dbmHandler, err := dbm.NewDbmHandler(a)
|
dbmHandler, err := dbm.NewDbmHandler(a)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
//save database after executabe ends
|
||||||
defer dbmHandler.SaveDb()
|
defer dbmHandler.SaveDb()
|
||||||
|
|
||||||
//initialize new server
|
//initialize new server
|
||||||
dbmHandler.Log.Debug("main", "initialize new server instance")
|
dbmHandler.Log.Debug("main", "initialize new server instance")
|
||||||
s := server.NewServer()
|
s := ws.NewServer(a.AllowOrigins, a.Port.Remote)
|
||||||
|
|
||||||
//set routes
|
//set routes
|
||||||
dbmHandler.Log.Debug("main", "setting routes")
|
dbmHandler.Log.Debug("main", "setting routes")
|
||||||
s.Routes.GET("/ws", dbmHandler.WebSocket)
|
s.Routes.GET("/ws", dbmHandler.WebSocket)
|
||||||
s.Routes.POST("/json_data", s.JsonRequest)
|
s.Routes.GET("/saveData", dbmHandler.SaveData)
|
||||||
|
s.Routes.POST("/json_data", dbmHandler.Json_Data)
|
||||||
|
s.Routes.DELETE("/json_data", dbmHandler.Delete)
|
||||||
s.Routes.GET("/", func(c *gin.Context) {
|
s.Routes.GET("/", func(c *gin.Context) {
|
||||||
c.String(200, "DBM WebSocket Server is running!")
|
c.String(200, "DBM WebSocket Server is running!")
|
||||||
})
|
})
|
||||||
|
|
||||||
go func() {
|
|
||||||
dbmHandler.Log.Info("main", fmt.Sprintf("http listen on %d", a.Port.Http))
|
|
||||||
// start http server
|
// start http server
|
||||||
if err := s.ServeHttp(a.Port.Http); err != nil {
|
go func() {
|
||||||
|
dbmHandler.Log.Info("main", fmt.Sprintf("http listen on ip: %s port: %d", a.Ip, a.Port.Http))
|
||||||
|
if err := s.ServeHttp(a.Ip, a.Port.Http); err != nil {
|
||||||
dbmHandler.Log.Error("main", "error http server "+err.Error())
|
dbmHandler.Log.Error("main", "error http server "+err.Error())
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
dbmHandler.Log.Info("main", fmt.Sprintf("https listen on %d", a.Port.Https))
|
// start https server
|
||||||
panic(s.ServeHttps(a.Port.Https, a.Cert))
|
dbmHandler.Log.Info("main", fmt.Sprintf("https listen on ip: %s port: %d", a.Ip, a.Port.Https))
|
||||||
|
if err := s.ServeHttps(a.Ip, a.Port.Https, a.Cert); err != nil {
|
||||||
|
dbmHandler.Log.Error("main", "error http server "+err.Error())
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
562
models/datapoint.go
Normal file
562
models/datapoint.go
Normal file
@@ -0,0 +1,562 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"regexp"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-dbm/utils"
|
||||||
|
ws "gitea.tecamino.com/paadi/tecamino-dbm/websocket"
|
||||||
|
wsModels "gitea.tecamino.com/paadi/tecamino-dbm/websocket/models"
|
||||||
|
json_data "gitea.tecamino.com/paadi/tecamino-json_data"
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
OnCreate = "onCreate"
|
||||||
|
OnChange = "onChange"
|
||||||
|
OnDelete = "onDelete"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Datapoint struct {
|
||||||
|
Uuid uuid.UUID `json:"uuid"`
|
||||||
|
Value any `json:"value,omitempty"`
|
||||||
|
Path string `json:"path"`
|
||||||
|
CreateDateTime int64 `json:"createDateTime,omitempty"`
|
||||||
|
UpdateDateTime int64 `json:"updateDateTime,omitempty"`
|
||||||
|
Datapoints map[string]*Datapoint `json:"-"`
|
||||||
|
Drivers json_dataModels.Drivers `json:"drivers,omitempty"`
|
||||||
|
Subscriptions Subscriptions `json:"-"`
|
||||||
|
Type json_dataModels.Type `json:"type"`
|
||||||
|
ReadWrite json_dataModels.Rights `json:"readWrite"`
|
||||||
|
HasChild bool `json:"-"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) Set(path string, set json_dataModels.Set) (bool, error) {
|
||||||
|
var changed bool
|
||||||
|
if path != "" {
|
||||||
|
changed = true
|
||||||
|
d.Path = path
|
||||||
|
}
|
||||||
|
|
||||||
|
if set.Type != "" {
|
||||||
|
changed = true
|
||||||
|
d.Type = set.Type
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.Type != "" {
|
||||||
|
if d.Value == nil && set.Value == nil {
|
||||||
|
changed = true
|
||||||
|
d.Value = d.Type.DefaultValue()
|
||||||
|
} else if d.Value != d.Type.ConvertValue(set.Value) {
|
||||||
|
changed = true
|
||||||
|
d.Value = d.Type.ConvertValue(set.Value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if set.Rights != "" {
|
||||||
|
changed = true
|
||||||
|
d.ReadWrite = set.Rights.GetRights()
|
||||||
|
}
|
||||||
|
|
||||||
|
if changed {
|
||||||
|
d.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
}
|
||||||
|
|
||||||
|
if set.Driver == nil {
|
||||||
|
return changed, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if d.Drivers == nil {
|
||||||
|
d.Drivers = json_dataModels.Drivers{}
|
||||||
|
}
|
||||||
|
d.Drivers.AddDriver(set.Driver)
|
||||||
|
|
||||||
|
changed = true
|
||||||
|
d.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
|
||||||
|
return changed, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) GetValueUint64() uint64 {
|
||||||
|
return utils.Uint64From(d.Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) CreateDatapoints(uuids *Uuids, sets ...json_dataModels.Set) (created []json_dataModels.Set, err error) {
|
||||||
|
if len(sets) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
publishes := []json_dataModels.Publish{}
|
||||||
|
|
||||||
|
for _, dp := range sets {
|
||||||
|
|
||||||
|
if dp.Path == "" && dp.Uuid != uuid.Nil {
|
||||||
|
existing := uuids.GetDatapoint(dp.Uuid)
|
||||||
|
_, err := existing.Set("", dp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
created = append(created, json_dataModels.Set{
|
||||||
|
Uuid: existing.Uuid,
|
||||||
|
Path: existing.Path,
|
||||||
|
Type: existing.Type,
|
||||||
|
Value: existing.Value,
|
||||||
|
Rights: existing.ReadWrite,
|
||||||
|
Drivers: &existing.Drivers,
|
||||||
|
Updated: true,
|
||||||
|
HasChild: existing.HasChild,
|
||||||
|
})
|
||||||
|
|
||||||
|
existing.Publish(OnChange)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
parts := strings.Split(dp.Path, ":")
|
||||||
|
|
||||||
|
current := d
|
||||||
|
for i, part := range parts {
|
||||||
|
if current.Datapoints == nil {
|
||||||
|
current.Datapoints = make(map[string]*Datapoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
if i == len(parts)-1 {
|
||||||
|
// Leaf node: create or update datapoint
|
||||||
|
if existing, ok := current.Datapoints[part]; ok {
|
||||||
|
|
||||||
|
_, err := existing.Set("", dp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
created = append(created, json_dataModels.Set{
|
||||||
|
Uuid: existing.Uuid,
|
||||||
|
Path: existing.Path,
|
||||||
|
Type: existing.Type,
|
||||||
|
Value: existing.Value,
|
||||||
|
Rights: existing.ReadWrite,
|
||||||
|
Drivers: &existing.Drivers,
|
||||||
|
Updated: true,
|
||||||
|
HasChild: existing.HasChild,
|
||||||
|
})
|
||||||
|
|
||||||
|
existing.Publish(OnChange)
|
||||||
|
} else {
|
||||||
|
var uid uuid.UUID = uuid.New()
|
||||||
|
if dp.Uuid != uuid.Nil {
|
||||||
|
uid = dp.Uuid
|
||||||
|
}
|
||||||
|
ndp := &Datapoint{
|
||||||
|
Uuid: uid,
|
||||||
|
CreateDateTime: time.Now().UnixMilli(),
|
||||||
|
Subscriptions: InitSubscribtion(),
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create new
|
||||||
|
current.Datapoints[part] = ndp
|
||||||
|
|
||||||
|
_, err := ndp.Set(strings.Join(parts, ":"), dp)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
//add uuid to flat map for faster lookup
|
||||||
|
renamedDps := uuids.AddDatapoint(current, ndp)
|
||||||
|
created = append(created, renamedDps...)
|
||||||
|
created = append(created, json_dataModels.Set{
|
||||||
|
Uuid: ndp.Uuid,
|
||||||
|
Path: ndp.Path,
|
||||||
|
Type: ndp.Type,
|
||||||
|
Value: ndp.Value,
|
||||||
|
Rights: ndp.ReadWrite,
|
||||||
|
Driver: dp.Driver,
|
||||||
|
HasChild: ndp.HasChild,
|
||||||
|
})
|
||||||
|
|
||||||
|
publishes = append(publishes, json_dataModels.Publish{
|
||||||
|
Event: OnCreate,
|
||||||
|
Uuid: ndp.Uuid,
|
||||||
|
Path: ndp.Path,
|
||||||
|
Type: ndp.Type,
|
||||||
|
Value: ndp.Value,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Traverse or create intermediate datapoints
|
||||||
|
if next, ok := current.Datapoints[part]; ok {
|
||||||
|
current = next
|
||||||
|
} else {
|
||||||
|
newDp := &Datapoint{
|
||||||
|
Uuid: uuid.New(),
|
||||||
|
Path: strings.Join(parts[:i+1], ":"),
|
||||||
|
Type: json_dataModels.NONE,
|
||||||
|
CreateDateTime: time.Now().UnixMilli(),
|
||||||
|
UpdateDateTime: time.Now().UnixMilli(),
|
||||||
|
Subscriptions: InitSubscribtion(),
|
||||||
|
}
|
||||||
|
|
||||||
|
//add uuid to flat map for faster lookup
|
||||||
|
renamedDps := uuids.AddDatapoint(current, newDp)
|
||||||
|
created = append(created, renamedDps...)
|
||||||
|
created = append(created, json_dataModels.Set{
|
||||||
|
Uuid: newDp.Uuid,
|
||||||
|
Path: newDp.Path,
|
||||||
|
Type: newDp.Type,
|
||||||
|
Value: newDp.Value,
|
||||||
|
Rights: newDp.ReadWrite,
|
||||||
|
HasChild: newDp.HasChild,
|
||||||
|
})
|
||||||
|
|
||||||
|
if dp.Rights != "" {
|
||||||
|
newDp.ReadWrite = dp.Rights.GetRights()
|
||||||
|
}
|
||||||
|
|
||||||
|
publishes = append(publishes, json_dataModels.Publish{
|
||||||
|
Event: OnCreate,
|
||||||
|
Uuid: newDp.Uuid,
|
||||||
|
Path: newDp.Path,
|
||||||
|
Type: newDp.Type,
|
||||||
|
Value: newDp.Value,
|
||||||
|
})
|
||||||
|
|
||||||
|
current.Datapoints[part] = newDp
|
||||||
|
current = newDp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.Publish = append(r.Publish, publishes...)
|
||||||
|
|
||||||
|
b, err := json.Marshal(r)
|
||||||
|
if err != nil {
|
||||||
|
return created, err
|
||||||
|
}
|
||||||
|
ws.SendBroadcast(b)
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) ImportDatapoint(uuids *Uuids, dp *Datapoint, path string) (err error) {
|
||||||
|
parts := strings.Split(dp.Path, ":")
|
||||||
|
|
||||||
|
current := d
|
||||||
|
for i, part := range parts {
|
||||||
|
if current.Datapoints == nil {
|
||||||
|
current.Datapoints = make(map[string]*Datapoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
if i == len(parts)-1 {
|
||||||
|
// Leaf node: import the datapoint
|
||||||
|
if existing, ok := current.Datapoints[part]; ok {
|
||||||
|
existing.Type = dp.Type
|
||||||
|
existing.Value = dp.Type.ConvertValue(dp.Value)
|
||||||
|
existing.ReadWrite = dp.ReadWrite.GetRights()
|
||||||
|
existing.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
dp.Publish(OnChange)
|
||||||
|
} else {
|
||||||
|
dp.Path = strings.Join(parts, ":")
|
||||||
|
dp.ReadWrite = dp.ReadWrite.GetRights()
|
||||||
|
dp.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
dp.Subscriptions = InitSubscribtion()
|
||||||
|
current.Datapoints[part] = dp
|
||||||
|
//add uuid to flat map for faster lookup
|
||||||
|
uuids.AddDatapoint(current, dp)
|
||||||
|
|
||||||
|
dp.Publish(OnChange)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Traverse or create intermediate nodes
|
||||||
|
if next, ok := current.Datapoints[part]; ok {
|
||||||
|
current = next
|
||||||
|
} else {
|
||||||
|
newDp := &Datapoint{
|
||||||
|
Path: strings.Join(parts[:i+1], ":"),
|
||||||
|
Type: json_dataModels.NONE,
|
||||||
|
ReadWrite: dp.ReadWrite.GetRights(),
|
||||||
|
UpdateDateTime: time.Now().UnixMilli(),
|
||||||
|
}
|
||||||
|
newDp.ReadWrite = newDp.ReadWrite.GetRights()
|
||||||
|
current.Datapoints[part] = newDp
|
||||||
|
current = newDp
|
||||||
|
//add uuid to flat map for faster lookup
|
||||||
|
uuids.AddDatapoint(current, newDp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) UpdateDatapointValue(value any, path string) error {
|
||||||
|
|
||||||
|
paths := strings.Split(path, ":")
|
||||||
|
|
||||||
|
current := d
|
||||||
|
for i, part := range paths {
|
||||||
|
dp, ok := current.Datapoints[part]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("datapoint path not found: %s (at %s)", path, part)
|
||||||
|
}
|
||||||
|
if i == len(paths)-1 {
|
||||||
|
dp.Value = dp.Type.ConvertValue(value)
|
||||||
|
dp.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
dp.Publish(OnChange)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
current = dp
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) UpdateValue(value any) error {
|
||||||
|
d.Value = d.Type.ConvertValue(value)
|
||||||
|
d.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
d.Publish(OnChange)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// removes datapoint and its children if path is given
|
||||||
|
// if path and
|
||||||
|
func (d *Datapoint) RemoveDatapoint(set json_dataModels.Set) (sets []json_dataModels.Set, err error) {
|
||||||
|
parts := strings.Split(set.Path, ":")
|
||||||
|
|
||||||
|
if len(parts) < 1 {
|
||||||
|
return sets, fmt.Errorf("invalid path: '%s'", set.Path)
|
||||||
|
}
|
||||||
|
|
||||||
|
publishes := []json_dataModels.Publish{}
|
||||||
|
|
||||||
|
current := d
|
||||||
|
for i := 0; i < len(parts)-1; i++ {
|
||||||
|
next, ok := current.Datapoints[parts[i]]
|
||||||
|
if !ok {
|
||||||
|
return sets, fmt.Errorf("path not found: '%s'", strings.Join(parts[:i+1], ":"))
|
||||||
|
}
|
||||||
|
current = next
|
||||||
|
}
|
||||||
|
|
||||||
|
toDelete := parts[len(parts)-1]
|
||||||
|
if dp, ok := current.Datapoints[toDelete]; ok {
|
||||||
|
//if driver information found, remoove only driver information
|
||||||
|
if set.Driver != nil {
|
||||||
|
dp.RemoveDriver(set.Driver)
|
||||||
|
publishes = append(publishes, json_dataModels.Publish{
|
||||||
|
Event: OnChange,
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
Value: dp.Value,
|
||||||
|
Drivers: &dp.Drivers,
|
||||||
|
})
|
||||||
|
sets = append(sets, json_dataModels.Set{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
Drivers: &dp.Drivers,
|
||||||
|
Value: dp.Value,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
s, pubs := removeChildren(dp)
|
||||||
|
sets = append(sets, s...)
|
||||||
|
publishes = append(publishes, pubs...)
|
||||||
|
publishes = append(publishes, json_dataModels.Publish{
|
||||||
|
Event: OnDelete,
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
})
|
||||||
|
sets = append(sets, json_dataModels.Set{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
})
|
||||||
|
delete(current.Datapoints, toDelete)
|
||||||
|
}
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.Publish = append(r.Publish, publishes...)
|
||||||
|
|
||||||
|
b, err := json.Marshal(r)
|
||||||
|
if err != nil {
|
||||||
|
return sets, err
|
||||||
|
}
|
||||||
|
ws.SendBroadcast(b)
|
||||||
|
|
||||||
|
return sets, nil
|
||||||
|
}
|
||||||
|
return sets, fmt.Errorf("datapoint '%s' not found", set.Path)
|
||||||
|
}
|
||||||
|
|
||||||
|
// removes all children and grandchlidren of datapoint
|
||||||
|
func removeChildren(dp *Datapoint) (sets []json_dataModels.Set, pubs []json_dataModels.Publish) {
|
||||||
|
for name, d := range dp.Datapoints {
|
||||||
|
s, p := removeChildren(d)
|
||||||
|
sets = append(sets, s...)
|
||||||
|
pubs = append(pubs, p...)
|
||||||
|
|
||||||
|
sets = append(sets, json_dataModels.Set{
|
||||||
|
Uuid: d.Uuid,
|
||||||
|
Path: d.Path,
|
||||||
|
})
|
||||||
|
delete(d.Datapoints, name)
|
||||||
|
}
|
||||||
|
return sets, pubs
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) GetAllDatapoints(depth uint) (dps Datapoints) {
|
||||||
|
|
||||||
|
dps = append(dps, d)
|
||||||
|
if depth == 1 {
|
||||||
|
return
|
||||||
|
} else if depth > 0 {
|
||||||
|
depth--
|
||||||
|
}
|
||||||
|
var dfs func(dp *Datapoint, currentDepth uint)
|
||||||
|
dfs = func(dp *Datapoint, currentDepth uint) {
|
||||||
|
switch depth {
|
||||||
|
case 0:
|
||||||
|
// Return all descendants
|
||||||
|
case currentDepth:
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, child := range dp.Datapoints {
|
||||||
|
dps = append(dps, child)
|
||||||
|
dfs(child, currentDepth+1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dfs(d, 0)
|
||||||
|
dps.SortSlice()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) QueryDatapoints(depth uint, path string) (dps Datapoints) {
|
||||||
|
parts := strings.Split(path, ":")
|
||||||
|
|
||||||
|
var dfs func(current *Datapoint, index int)
|
||||||
|
dfs = func(current *Datapoint, index int) {
|
||||||
|
if index == len(parts) || path == "" {
|
||||||
|
dps = append(dps, current.GetAllDatapoints(depth)...)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
pattern := "^" + parts[index] + "$"
|
||||||
|
re, err := regexp.Compile(pattern)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, dp := range current.Datapoints {
|
||||||
|
if re.MatchString(name) {
|
||||||
|
dfs(dp, index+1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dfs(d, 0)
|
||||||
|
dps.SortSlice()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) AddSubscribtion(conn *wsModels.Client, sub json_dataModels.Subscription) {
|
||||||
|
if d.Subscriptions == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if s, ok := d.Subscriptions[conn]; ok {
|
||||||
|
s.OnCreate = sub.OnCreate
|
||||||
|
s.OnChange = sub.OnChange
|
||||||
|
s.OnDelete = sub.OnDelete
|
||||||
|
} else {
|
||||||
|
d.Subscriptions[conn] = &Subscription{
|
||||||
|
OnCreate: sub.OnCreate,
|
||||||
|
OnChange: sub.OnChange,
|
||||||
|
OnDelete: sub.OnDelete,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) RenamePaths(oldPath string) (renamed []json_dataModels.Set) {
|
||||||
|
visited := make(map[*Datapoint]bool)
|
||||||
|
|
||||||
|
if len(d.Datapoints) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, dp := range d.Datapoints {
|
||||||
|
dp.Path = strings.Replace(dp.Path, oldPath, d.Path, 1)
|
||||||
|
renamedDps := dp.renameSubPaths(oldPath, d.Path, visited)
|
||||||
|
renamed = append(renamed, renamedDps...)
|
||||||
|
renamed = append(renamed, json_dataModels.Set{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
Type: dp.Type,
|
||||||
|
Value: dp.Value,
|
||||||
|
Rights: dp.ReadWrite,
|
||||||
|
Drivers: &dp.Drivers,
|
||||||
|
HasChild: dp.HasChild,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) renameSubPaths(oldPath, newPath string, visited map[*Datapoint]bool) (renamed []json_dataModels.Set) {
|
||||||
|
if visited[d] {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
visited[d] = true
|
||||||
|
|
||||||
|
if len(d.Datapoints) == 0 {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, dp := range d.Datapoints {
|
||||||
|
dp.Path = strings.Replace(dp.Path, oldPath, newPath, 1)
|
||||||
|
renamedDps := dp.renameSubPaths(oldPath, newPath, visited)
|
||||||
|
renamed = append(renamed, renamedDps...)
|
||||||
|
renamed = append(renamed, json_dataModels.Set{
|
||||||
|
Uuid: dp.Uuid,
|
||||||
|
Path: dp.Path,
|
||||||
|
Type: dp.Type,
|
||||||
|
Value: dp.Value,
|
||||||
|
Rights: dp.ReadWrite,
|
||||||
|
Drivers: &dp.Drivers,
|
||||||
|
HasChild: dp.HasChild,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) RemoveSubscribtion(client *wsModels.Client) {
|
||||||
|
delete(d.Subscriptions, client)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) RemoveDriver(driver *json_dataModels.Driver) {
|
||||||
|
d.Drivers.RemoveDriver(driver)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *Datapoint) Publish(eventType string) error {
|
||||||
|
r := json_data.NewResponse()
|
||||||
|
r.AddPublish(json_dataModels.Publish{
|
||||||
|
Event: eventType,
|
||||||
|
Uuid: d.Uuid,
|
||||||
|
Path: d.Path,
|
||||||
|
Type: d.Type,
|
||||||
|
Value: d.Value,
|
||||||
|
})
|
||||||
|
|
||||||
|
b, err := json.Marshal(r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
switch eventType {
|
||||||
|
case OnCreate, OnDelete:
|
||||||
|
ws.SendBroadcast(b)
|
||||||
|
default:
|
||||||
|
for client := range d.Subscriptions {
|
||||||
|
client.SendResponse(b)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,277 +1,12 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import "sort"
|
||||||
"fmt"
|
|
||||||
"regexp"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/zuadi/tecamino-dbm/utils"
|
type Datapoints []*Datapoint
|
||||||
)
|
|
||||||
|
|
||||||
type Datapoint struct {
|
func (d *Datapoints) SortSlice() {
|
||||||
Datapoints map[string]*Datapoint `json:"-"`
|
// Sort by Path before processing
|
||||||
Path string `json:"path"`
|
sort.Slice(*d, func(i, j int) bool {
|
||||||
Value any `json:"value,omitempty"`
|
return (*d)[i].Path < (*d)[j].Path
|
||||||
CreateDateTime int64 `json:"createDateTime,omitempty"`
|
})
|
||||||
UpdateDateTime int64 `json:"updateDateTime,omitempty"`
|
|
||||||
Type Type `json:"type"`
|
|
||||||
ReadWrite Rights `json:"readWrite"`
|
|
||||||
Drivers map[string]*Driver `json:"-"`
|
|
||||||
Subscribtions Subscribtions `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) CreateDatapoint(typ Type, value any, rights Rights, path string) error {
|
|
||||||
parts := regexp.MustCompile(`[:]+`).Split(path, -1)
|
|
||||||
|
|
||||||
current := d
|
|
||||||
for i, part := range parts {
|
|
||||||
if current.Datapoints == nil {
|
|
||||||
current.Datapoints = make(map[string]*Datapoint)
|
|
||||||
}
|
|
||||||
|
|
||||||
if i == len(parts)-1 {
|
|
||||||
// Leaf node: create or update datapoint
|
|
||||||
if existing, ok := current.Datapoints[part]; ok {
|
|
||||||
// Update existing
|
|
||||||
existing.Type = typ
|
|
||||||
existing.ReadWrite = rights.GetRights()
|
|
||||||
existing.Value = typ.ConvertValue(value)
|
|
||||||
existing.UpdateDateTime = time.Now().UnixMilli()
|
|
||||||
} else {
|
|
||||||
// Create new
|
|
||||||
current.Datapoints[part] = &Datapoint{
|
|
||||||
Path: strings.Join(parts, ":"),
|
|
||||||
Type: typ,
|
|
||||||
Value: typ.ConvertValue(value),
|
|
||||||
ReadWrite: rights.GetRights(),
|
|
||||||
CreateDateTime: time.Now().UnixMilli(),
|
|
||||||
UpdateDateTime: time.Now().UnixMilli(),
|
|
||||||
Subscribtions: InitSubscribtion(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Traverse or create intermediate datapoints
|
|
||||||
if next, ok := current.Datapoints[part]; ok {
|
|
||||||
current = next
|
|
||||||
} else {
|
|
||||||
newDp := &Datapoint{
|
|
||||||
Path: strings.Join(parts[:i+1], ":"),
|
|
||||||
Type: NONE,
|
|
||||||
ReadWrite: rights.GetRights(),
|
|
||||||
CreateDateTime: time.Now().UnixMilli(),
|
|
||||||
UpdateDateTime: time.Now().UnixMilli(),
|
|
||||||
Subscribtions: InitSubscribtion(),
|
|
||||||
}
|
|
||||||
current.Datapoints[part] = newDp
|
|
||||||
current = newDp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) ImportDatapoint(dp *Datapoint, path string) error {
|
|
||||||
parts := regexp.MustCompile(`[:]+`).Split(path, -1)
|
|
||||||
|
|
||||||
current := d
|
|
||||||
for i, part := range parts {
|
|
||||||
if current.Datapoints == nil {
|
|
||||||
current.Datapoints = make(map[string]*Datapoint)
|
|
||||||
}
|
|
||||||
|
|
||||||
if i == len(parts)-1 {
|
|
||||||
// Leaf node: import the datapoint
|
|
||||||
if existing, ok := current.Datapoints[part]; ok {
|
|
||||||
existing.Type = dp.Type
|
|
||||||
existing.Value = current.Type.ConvertValue(dp.Value)
|
|
||||||
existing.ReadWrite = dp.ReadWrite.GetRights()
|
|
||||||
existing.UpdateDateTime = time.Now().UnixMilli()
|
|
||||||
} else {
|
|
||||||
dp.Path = strings.Join(parts, ":")
|
|
||||||
dp.ReadWrite = dp.ReadWrite.GetRights()
|
|
||||||
dp.UpdateDateTime = time.Now().UnixMilli()
|
|
||||||
dp.Subscribtions = InitSubscribtion()
|
|
||||||
current.Datapoints[part] = dp
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Traverse or create intermediate nodes
|
|
||||||
if next, ok := current.Datapoints[part]; ok {
|
|
||||||
current = next
|
|
||||||
} else {
|
|
||||||
newDp := &Datapoint{
|
|
||||||
Path: strings.Join(parts[:i+1], ":"),
|
|
||||||
Type: NONE,
|
|
||||||
ReadWrite: dp.ReadWrite.GetRights(),
|
|
||||||
UpdateDateTime: time.Now().UnixMilli(),
|
|
||||||
}
|
|
||||||
newDp.ReadWrite = newDp.ReadWrite.GetRights()
|
|
||||||
current.Datapoints[part] = newDp
|
|
||||||
current = newDp
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) UpdateDatapointValue(value any, path string) error {
|
|
||||||
|
|
||||||
paths := regexp.MustCompile(`[:]+`).Split(path, -1)
|
|
||||||
|
|
||||||
current := d
|
|
||||||
for i, part := range paths {
|
|
||||||
dp, ok := current.Datapoints[part]
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("datapoint path not found: %s (at %s)", path, part)
|
|
||||||
}
|
|
||||||
if i == len(paths)-1 {
|
|
||||||
dp.Value = dp.Type.ConvertValue(value)
|
|
||||||
dp.UpdateDateTime = time.Now().UnixMilli()
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
current = dp
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) RemoveDatapoint(path string) error {
|
|
||||||
parts := regexp.MustCompile(`[:]+`).Split(path, -1)
|
|
||||||
|
|
||||||
if len(parts) < 1 {
|
|
||||||
return fmt.Errorf("invalid path: '%s'", path)
|
|
||||||
}
|
|
||||||
|
|
||||||
current := d
|
|
||||||
for i := range len(parts) - 1 {
|
|
||||||
next, ok := current.Datapoints[parts[i]]
|
|
||||||
if !ok {
|
|
||||||
return fmt.Errorf("path not found: '%s'", strings.Join(parts[:i+1], ":"))
|
|
||||||
}
|
|
||||||
current = next
|
|
||||||
}
|
|
||||||
|
|
||||||
toDelete := parts[len(parts)-1]
|
|
||||||
if _, ok := current.Datapoints[toDelete]; ok {
|
|
||||||
delete(current.Datapoints, toDelete)
|
|
||||||
fmt.Println("Removed datapoint:", path)
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Errorf("datapoint '%s' not found", path)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) GetAllDatapoints(depth int) (dps []*Datapoint) {
|
|
||||||
|
|
||||||
var dfs func(dp *Datapoint, currentDepth int)
|
|
||||||
dfs = func(dp *Datapoint, currentDepth int) {
|
|
||||||
if currentDepth == 0 {
|
|
||||||
dps = append(dps, dp)
|
|
||||||
}
|
|
||||||
|
|
||||||
if depth == 1 {
|
|
||||||
return
|
|
||||||
} else if depth == 0 {
|
|
||||||
// Return all descendants
|
|
||||||
for _, child := range dp.Datapoints {
|
|
||||||
dps = append(dps, child)
|
|
||||||
dfs(child, currentDepth+1)
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if currentDepth == depth-1 {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, child := range dp.Datapoints {
|
|
||||||
dfs(child, currentDepth+1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dfs(d, 0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) QueryDatapoints(depth int, path string) (dps []*Datapoint) {
|
|
||||||
parts := strings.Split(path, ":")
|
|
||||||
|
|
||||||
var dfs func(current *Datapoint, index int)
|
|
||||||
dfs = func(current *Datapoint, index int) {
|
|
||||||
|
|
||||||
if index == len(parts) {
|
|
||||||
dps = append(dps, current.GetAllDatapoints(depth)...)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
pattern := "^" + parts[index] + "$"
|
|
||||||
re, err := regexp.Compile(pattern)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for name, dp := range current.Datapoints {
|
|
||||||
if re.MatchString(name) {
|
|
||||||
dfs(dp, index+1)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dfs(d, 0)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) AddSubscribtion(id string, sub *Subscribe) {
|
|
||||||
if d.Subscribtions == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if s, ok := d.Subscribtions[id]; ok {
|
|
||||||
s.OnCreate = sub.OnCreate
|
|
||||||
s.OnChange = sub.OnChange
|
|
||||||
s.OnDelete = sub.OnDelete
|
|
||||||
} else {
|
|
||||||
d.Subscribtions[id] = &Subscribtion{
|
|
||||||
OnCreate: sub.OnCreate,
|
|
||||||
OnChange: sub.OnChange,
|
|
||||||
OnDelete: sub.OnDelete,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) RemoveSubscribtion(id string) {
|
|
||||||
if _, ok := d.Subscribtions[id]; !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
delete(d.Subscribtions, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) AddDriver(driver, bus string, adr int) {
|
|
||||||
if d.Drivers == nil {
|
|
||||||
d.Drivers = make(map[string]*Driver)
|
|
||||||
}
|
|
||||||
|
|
||||||
d.Drivers[driver] = &Driver{
|
|
||||||
Bus: bus,
|
|
||||||
Address: adr,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) AddDriverSubscribtion(id string, sub *Subscribe) {
|
|
||||||
if s, ok := d.Subscribtions[id]; ok {
|
|
||||||
s.OnCreate = sub.OnCreate
|
|
||||||
s.OnChange = sub.OnChange
|
|
||||||
s.OnDelete = sub.OnDelete
|
|
||||||
} else {
|
|
||||||
d.Subscribtions[id] = &Subscribtion{
|
|
||||||
OnCreate: sub.OnCreate,
|
|
||||||
OnChange: sub.OnChange,
|
|
||||||
OnDelete: sub.OnDelete,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (d *Datapoint) GetValueUint64() uint64 {
|
|
||||||
return utils.Uint64From(d.Value)
|
|
||||||
}
|
}
|
||||||
|
|||||||
178
models/dbm.go
Normal file
178
models/dbm.go
Normal file
@@ -0,0 +1,178 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"runtime"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-dbm/utils"
|
||||||
|
ws "gitea.tecamino.com/paadi/tecamino-dbm/websocket"
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-logger/logging"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DBM struct {
|
||||||
|
Datapoints Datapoint
|
||||||
|
Uuids *Uuids
|
||||||
|
Conns *ws.ClientHandler
|
||||||
|
Log *logging.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
var SystemDatapoints uuid.UUID
|
||||||
|
|
||||||
|
func NewDBM(conns *ws.ClientHandler, log *logging.Logger) *DBM {
|
||||||
|
return &DBM{
|
||||||
|
Uuids: &Uuids{},
|
||||||
|
Conns: conns,
|
||||||
|
Log: log,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) CreateDatapoints(sets ...json_dataModels.Set) ([]json_dataModels.Set, error) {
|
||||||
|
if len(sets) == 0 {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
dps, err := d.Datapoints.CreateDatapoints(d.Uuids, sets...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
var ndp uint64
|
||||||
|
for _, dp := range dps {
|
||||||
|
if !dp.Updated {
|
||||||
|
ndp++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
d.ModifyCountedDatapoints(ndp, false)
|
||||||
|
return dps, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) ImportDatapoints(dps ...*Datapoint) error {
|
||||||
|
for _, dp := range dps {
|
||||||
|
err := d.Datapoints.ImportDatapoint(d.Uuids, dp, dp.Path)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
d.ModifyCountedDatapoints(1, false)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) UpdateDatapointValue(value any, uid uuid.UUID, path ...string) error {
|
||||||
|
if uid != uuid.Nil {
|
||||||
|
dp := d.Uuids.GetDatapoint(uid)
|
||||||
|
if dp == nil {
|
||||||
|
return fmt.Errorf("uuid %s not found", uid.String())
|
||||||
|
}
|
||||||
|
dp.Value = dp.Type.ConvertValue(value)
|
||||||
|
dp.UpdateDateTime = time.Now().UnixMilli()
|
||||||
|
dp.Publish(OnChange)
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(path) > 1 {
|
||||||
|
return fmt.Errorf("only one path allowed")
|
||||||
|
}
|
||||||
|
|
||||||
|
return d.Datapoints.UpdateDatapointValue(value, path[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) RemoveDatapoint(sets ...json_dataModels.Set) (lsRemoved []json_dataModels.Set, err error) {
|
||||||
|
for _, set := range sets {
|
||||||
|
if set.Path == "" {
|
||||||
|
if dp := d.Uuids.GetDatapoint(set.Uuid); dp != nil {
|
||||||
|
set.Path = dp.Path
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
lsRemoved, err = d.Datapoints.RemoveDatapoint(set)
|
||||||
|
if err != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
d.ModifyCountedDatapoints(uint64(len(lsRemoved)), true)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) QueryDatapoints(depth uint, uid uuid.UUID, key ...string) []*Datapoint {
|
||||||
|
if uid != uuid.Nil {
|
||||||
|
dp := d.Uuids.GetDatapoint(uid)
|
||||||
|
if dp == nil {
|
||||||
|
return nil
|
||||||
|
} else if depth == 1 {
|
||||||
|
return []*Datapoint{dp}
|
||||||
|
}
|
||||||
|
return append([]*Datapoint{}, dp.QueryDatapoints(depth, key[0])...)
|
||||||
|
}
|
||||||
|
return d.Datapoints.QueryDatapoints(depth, key[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) GetAllDatapoints(depth uint) (dps Datapoints) {
|
||||||
|
return d.Datapoints.GetAllDatapoints(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) GetNumbersOfDatapoints() uint64 {
|
||||||
|
return utils.Uint64From(d.Datapoints.Datapoints["System"].Datapoints["Datapoints"].Value)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) ModifyCountedDatapoints(count uint64, countDown bool) {
|
||||||
|
dp := d.QueryDatapoints(1, SystemDatapoints, "System:Datapoints")
|
||||||
|
amount := dp[0].GetValueUint64()
|
||||||
|
if countDown {
|
||||||
|
amount -= count
|
||||||
|
} else {
|
||||||
|
amount += count
|
||||||
|
}
|
||||||
|
d.UpdateDatapointValue(amount, SystemDatapoints, "System:Datapoints")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) GoSystemTime() error {
|
||||||
|
path := "System:Time"
|
||||||
|
|
||||||
|
typ := json_dataModels.STR
|
||||||
|
rights := json_dataModels.Read
|
||||||
|
_, err := d.CreateDatapoints(json_dataModels.Set{Path: path, Type: typ, Rights: rights})
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("system.GoSystemTime", err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
ticker := time.NewTicker(time.Second)
|
||||||
|
for range ticker.C {
|
||||||
|
if er := d.UpdateDatapointValue(time.Now().Format("2006-01-02 15:04:05"), uuid.Nil, path); er != nil {
|
||||||
|
d.Log.Error("dmb.Handler.AddSystemDps.UpdateDatapointValue", er.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (d *DBM) GoSystemMemory() error {
|
||||||
|
path := "System:UsedMemory"
|
||||||
|
|
||||||
|
typ := json_dataModels.STR
|
||||||
|
rights := json_dataModels.Read
|
||||||
|
_, err := d.CreateDatapoints(json_dataModels.Set{Path: path, Type: typ, Rights: rights})
|
||||||
|
if err != nil {
|
||||||
|
d.Log.Error("system.GoSystemMemory", err.Error())
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
|
for {
|
||||||
|
var m runtime.MemStats
|
||||||
|
runtime.ReadMemStats(&m)
|
||||||
|
mem := fmt.Sprintf("%.2f MB", float64(m.Alloc)/1024/1024)
|
||||||
|
if er := d.UpdateDatapointValue(mem, uuid.Nil, path); er != nil {
|
||||||
|
d.Log.Error("dmb.Handler.AddSystemDps.UpdateDatapointValue", er.Error())
|
||||||
|
}
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type Driver struct {
|
|
||||||
Bus string
|
|
||||||
Address int
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type Get struct {
|
|
||||||
Path string `json:"path"`
|
|
||||||
Query *Query `json:"query,omitempty"`
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type JsonData struct {
|
|
||||||
Get *[]Get `json:"get,omitempty"`
|
|
||||||
Set *[]Set `json:"set,omitempty"`
|
|
||||||
Subscribe *[]Subscribe `json:"subscribe,omitempty"`
|
|
||||||
Unsubscribe *[]Subscribe `json:"unsubscribe,omitempty"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewRequest() *JsonData {
|
|
||||||
return &JsonData{}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *JsonData) AddGet(path string, query Query) {
|
|
||||||
if r.Get == nil {
|
|
||||||
r.Get = &[]Get{}
|
|
||||||
}
|
|
||||||
|
|
||||||
*r.Get = append(*r.Get, Get{
|
|
||||||
Path: path,
|
|
||||||
Query: &query,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func (r *JsonData) AddSet(path string, value any, create bool) {
|
|
||||||
if r.Set == nil {
|
|
||||||
r.Set = &[]Set{}
|
|
||||||
}
|
|
||||||
|
|
||||||
*r.Set = append(*r.Set, Set{
|
|
||||||
Path: path,
|
|
||||||
Value: value,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type JsonResponse struct {
|
|
||||||
Error *bool `json:"error,omitempty"`
|
|
||||||
Message string `json:"message,omitempty"`
|
|
||||||
Data string `json:"data,omitempty"`
|
|
||||||
Event string `json:"event,omitempty"`
|
|
||||||
Path string `json:"path,omitempty"`
|
|
||||||
Value any `json:"value,omitempty"`
|
|
||||||
}
|
|
||||||
@@ -3,4 +3,5 @@ package models
|
|||||||
type Port struct {
|
type Port struct {
|
||||||
Http uint
|
Http uint
|
||||||
Https uint
|
Https uint
|
||||||
|
Remote uint
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type Query struct {
|
|
||||||
Depth int `json:"depth,omitempty"`
|
|
||||||
RegExp string `json:"regExp,omitempty"`
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type Rights string
|
|
||||||
|
|
||||||
const (
|
|
||||||
Read Rights = "R"
|
|
||||||
Write Rights = "W"
|
|
||||||
ReadWrite Rights = "RW"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (r *Rights) GetRights() Rights {
|
|
||||||
if r == nil {
|
|
||||||
return ReadWrite
|
|
||||||
} else if *r == "" {
|
|
||||||
return ReadWrite
|
|
||||||
}
|
|
||||||
return *r
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type Set struct {
|
|
||||||
Path string `json:"path"`
|
|
||||||
Driver *Driver `json:"driver,omitempty"`
|
|
||||||
Value any `json:"value,omitempty"`
|
|
||||||
Create bool `json:"create,omitempty"`
|
|
||||||
}
|
|
||||||
14
models/stringSlices.go
Normal file
14
models/stringSlices.go
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "strings"
|
||||||
|
|
||||||
|
type StringSlice []string
|
||||||
|
|
||||||
|
func (s *StringSlice) String() string {
|
||||||
|
return strings.Join(*s, ",")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *StringSlice) Set(value string) error {
|
||||||
|
*s = append(*s, value)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
type Subscribe struct {
|
|
||||||
Path string `json:"path"`
|
|
||||||
Depth int `json:"depth"`
|
|
||||||
Driver *string `json:"driver,omitempty"`
|
|
||||||
OnCreate bool `json:"onCreate"`
|
|
||||||
OnDelete bool `json:"onDelete"`
|
|
||||||
OnChange bool `json:"onChange"`
|
|
||||||
}
|
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
package models
|
package models
|
||||||
|
|
||||||
type Subscribtions map[string]*Subscribtion
|
import wsModels "gitea.tecamino.com/paadi/tecamino-dbm/websocket/models"
|
||||||
|
|
||||||
type Subscribtion struct {
|
type Subscriptions map[*wsModels.Client]*Subscription
|
||||||
|
|
||||||
|
type Subscription struct {
|
||||||
OnCreate bool
|
OnCreate bool
|
||||||
OnDelete bool
|
OnDelete bool
|
||||||
OnChange bool
|
OnChange bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func InitSubscribtion() Subscribtions {
|
func InitSubscribtion() Subscriptions {
|
||||||
return make(Subscribtions)
|
return make(Subscriptions)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,67 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"github.com/zuadi/tecamino-dbm/utils"
|
|
||||||
)
|
|
||||||
|
|
||||||
const (
|
|
||||||
NONE Type = "NONE"
|
|
||||||
BIT Type = "BIT"
|
|
||||||
BYU Type = "BYU" // UINT8
|
|
||||||
BYS Type = "BYS" // INT8
|
|
||||||
WOS Type = "WOS" // INT16
|
|
||||||
WOU Type = "WOU" // UINT16
|
|
||||||
DWS Type = "DWS" // INT32
|
|
||||||
DWU Type = "DWU" // UINT32
|
|
||||||
LOS Type = "LOS" // INT64
|
|
||||||
LOU Type = "LOU" // UINT64
|
|
||||||
F32 Type = "F32" // FLOAT32
|
|
||||||
F64 Type = "F64" // FLOAT64
|
|
||||||
STR Type = "STRING" // STRING
|
|
||||||
)
|
|
||||||
|
|
||||||
type Type string
|
|
||||||
|
|
||||||
func (t *Type) DefaultValue(v any) any {
|
|
||||||
switch *t {
|
|
||||||
case BIT:
|
|
||||||
return false
|
|
||||||
case BYS, BYU, WOS, WOU, DWS, DWU, LOS, LOU, F32, F64:
|
|
||||||
return 0
|
|
||||||
case STR:
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (t *Type) ConvertValue(v any) any {
|
|
||||||
switch *t {
|
|
||||||
case BIT:
|
|
||||||
return utils.BoolFrom(v)
|
|
||||||
case BYS:
|
|
||||||
return utils.Int8From(v)
|
|
||||||
case BYU:
|
|
||||||
return utils.Uint8From(v)
|
|
||||||
case WOS:
|
|
||||||
return utils.Int16From(v)
|
|
||||||
case WOU:
|
|
||||||
return utils.Uint16From(v)
|
|
||||||
case DWS:
|
|
||||||
return utils.Int32From(v)
|
|
||||||
case DWU:
|
|
||||||
return utils.Uint32From(v)
|
|
||||||
case LOS:
|
|
||||||
return utils.Int64From(v)
|
|
||||||
case LOU:
|
|
||||||
return utils.Uint64From(v)
|
|
||||||
case F32:
|
|
||||||
return utils.Float32From(v)
|
|
||||||
case F64:
|
|
||||||
return utils.Float64From(v)
|
|
||||||
case STR:
|
|
||||||
return fmt.Sprintf("%v", v)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
50
models/uuids.go
Normal file
50
models/uuids.go
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
"github.com/google/uuid"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Uuids map[uuid.UUID]*Datapoint
|
||||||
|
|
||||||
|
func NewUuids() *Uuids {
|
||||||
|
return &Uuids{}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *Uuids) AddDatapoint(parentDp, newDp *Datapoint) (renamed []json_dataModels.Set) {
|
||||||
|
if odp, ok := (*u)[newDp.Uuid]; ok {
|
||||||
|
if odp.Path == newDp.Path {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
newDp.Datapoints = odp.Datapoints
|
||||||
|
newDp.HasChild = len(odp.Datapoints) > 0
|
||||||
|
odp.Datapoints = map[string]*Datapoint{}
|
||||||
|
renamed = newDp.RenamePaths(odp.Path)
|
||||||
|
rmDps, _ := parentDp.RemoveDatapoint(json_dataModels.Set{Path: odp.Path})
|
||||||
|
datapoints := u.GetDatapointByPath("System:Datapoints")
|
||||||
|
datapoints.UpdateValue(datapoints.Value.(uint64) - uint64(len(rmDps)))
|
||||||
|
}
|
||||||
|
|
||||||
|
(*u)[newDp.Uuid] = newDp
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *Uuids) GetDatapoint(uuid uuid.UUID) *Datapoint {
|
||||||
|
if dp, ok := (*u)[uuid]; ok {
|
||||||
|
return dp
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *Uuids) GetDatapointByPath(path string) *Datapoint {
|
||||||
|
for _, dp := range *u {
|
||||||
|
if dp.Path == path {
|
||||||
|
return dp
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (u *Uuids) RemoveDatapoint(uuid uuid.UUID) {
|
||||||
|
delete(*u, uuid)
|
||||||
|
}
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/zuadi/tecamino-dbm/models"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (s *Server) JsonRequest(c *gin.Context) {
|
|
||||||
var payload models.JsonData
|
|
||||||
|
|
||||||
if err := c.BindJSON(&payload); err != nil {
|
|
||||||
c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if payload.Set != nil {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
c.JSON(200, gin.H{
|
|
||||||
"name": payload,
|
|
||||||
})
|
|
||||||
return
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,82 +0,0 @@
|
|||||||
package models
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"fmt"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/coder/websocket"
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
)
|
|
||||||
|
|
||||||
var Origins []string = []string{"*"}
|
|
||||||
|
|
||||||
type Clients map[string]*Client
|
|
||||||
|
|
||||||
type Client struct {
|
|
||||||
Connected *bool `json:"connected"`
|
|
||||||
Conn *websocket.Conn `json:"-"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewClients() Clients {
|
|
||||||
return make(Clients)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect a recieving websocket connection
|
|
||||||
func (c *Clients) ConnectRecievingWsConnection(id string, ctx *gin.Context) error {
|
|
||||||
if _, exists := (*c)[id]; exists {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
conn, err := websocket.Accept(ctx.Writer, ctx.Request, &websocket.AcceptOptions{
|
|
||||||
OriginPatterns: Origins,
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return fmt.Errorf("error accept websocket client: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
b := true
|
|
||||||
(*c)[id] = &Client{
|
|
||||||
Connected: &b,
|
|
||||||
Conn: conn,
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Connect a recieving websocket connection
|
|
||||||
func (c *Clients) ConnectSendingWsConnection(id, url string) (*websocket.Conn, error) {
|
|
||||||
if _, exists := (*c)[id]; exists {
|
|
||||||
return (*c)[id].Conn, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
header := http.Header{}
|
|
||||||
header.Set("Authorization", "Bearer "+id)
|
|
||||||
|
|
||||||
conn, _, err := websocket.Dial(context.Background(), url, &websocket.DialOptions{
|
|
||||||
HTTPHeader: header,
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
b := true
|
|
||||||
(*c)[id] = &Client{
|
|
||||||
Connected: &b,
|
|
||||||
Conn: conn,
|
|
||||||
}
|
|
||||||
return conn, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Clients) RemoveClient(id string) {
|
|
||||||
delete(*c, id)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Clients) GetClientPointer(id string) *bool {
|
|
||||||
return (*c)[id].Connected
|
|
||||||
}
|
|
||||||
|
|
||||||
func (c *Clients) DisconnectWsConnection(id string, code websocket.StatusCode, reason string) {
|
|
||||||
*(*c)[id].Connected = false
|
|
||||||
(*c)[id].Conn.Close(code, reason)
|
|
||||||
}
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"sync"
|
|
||||||
|
|
||||||
"github.com/gin-gonic/gin"
|
|
||||||
"github.com/tecamino/tecamino-logger/logging"
|
|
||||||
"github.com/zuadi/tecamino-dbm/cert"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Server struct {
|
|
||||||
Routes *gin.Engine
|
|
||||||
sync.RWMutex
|
|
||||||
Logger *logging.Logger
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewServer() *Server {
|
|
||||||
return &Server{
|
|
||||||
Routes: gin.Default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) ServeHttp(port uint) error {
|
|
||||||
return s.Routes.Run(fmt.Sprintf(":%d", port))
|
|
||||||
}
|
|
||||||
|
|
||||||
func (s *Server) ServeHttps(port uint, cert cert.Cert) error {
|
|
||||||
return s.Routes.RunTLS(fmt.Sprintf(":%d", port), cert.CertFile, cert.KeyFile)
|
|
||||||
}
|
|
||||||
@@ -7,12 +7,13 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/zuadi/tecamino-dbm/args"
|
"gitea.tecamino.com/paadi/tecamino-dbm/args"
|
||||||
"github.com/zuadi/tecamino-dbm/cert"
|
"gitea.tecamino.com/paadi/tecamino-dbm/cert"
|
||||||
"github.com/zuadi/tecamino-dbm/dbm"
|
"gitea.tecamino.com/paadi/tecamino-dbm/dbm"
|
||||||
"github.com/zuadi/tecamino-dbm/models"
|
"gitea.tecamino.com/paadi/tecamino-dbm/models"
|
||||||
"github.com/zuadi/tecamino-dbm/server"
|
"gitea.tecamino.com/paadi/tecamino-dbm/utils"
|
||||||
"github.com/zuadi/tecamino-dbm/utils"
|
ws "gitea.tecamino.com/paadi/tecamino-dbm/websocket"
|
||||||
|
"github.com/google/uuid"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestCreateDps(t *testing.T) {
|
func TestCreateDps(t *testing.T) {
|
||||||
@@ -27,7 +28,7 @@ func TestCreateDps(t *testing.T) {
|
|||||||
KeyFile: "./cert/key.pem",
|
KeyFile: "./cert/key.pem",
|
||||||
},
|
},
|
||||||
RootDir: ".",
|
RootDir: ".",
|
||||||
DMAFile: "Test",
|
DBMFile: "Test",
|
||||||
Debug: false,
|
Debug: false,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -39,18 +40,18 @@ func TestCreateDps(t *testing.T) {
|
|||||||
ndps := utils.ListofA2ZZ()
|
ndps := utils.ListofA2ZZ()
|
||||||
l := len(ndps)
|
l := len(ndps)
|
||||||
s := time.Now()
|
s := time.Now()
|
||||||
for _, dp := range ndps {
|
// for _, dp := range ndps {
|
||||||
for i := 0; i < 100; i++ {
|
// for i := 0; i < 100; i++ {
|
||||||
err = dmaHandler.ImportDatapoints(&models.Datapoint{
|
// err = dmaHandler.ImportDatapoints(&models.Datapoint{
|
||||||
Path: fmt.Sprintf("Test:%s:%03d", dp, i),
|
// Path: fmt.Sprintf("Test:%s:%03d", dp, i),
|
||||||
Type: RandomType(),
|
// Type: models.RandomType(),
|
||||||
Value: rand.Int31(),
|
// Value: rand.Int31(),
|
||||||
})
|
// })
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
t.Fatal(err)
|
// t.Fatal(err)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
fmt.Printf("time used to create %d datapoints: %v\n", l*100, time.Since(s))
|
fmt.Printf("time used to create %d datapoints: %v\n", l*100, time.Since(s))
|
||||||
|
|
||||||
var m runtime.MemStats
|
var m runtime.MemStats
|
||||||
@@ -80,18 +81,14 @@ func TestQuery(t *testing.T) {
|
|||||||
KeyFile: "./cert/key.pem",
|
KeyFile: "./cert/key.pem",
|
||||||
},
|
},
|
||||||
RootDir: ".",
|
RootDir: ".",
|
||||||
DMAFile: "Test",
|
DBMFile: "Test",
|
||||||
Debug: false,
|
Debug: false,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// for i, o := range dmaHandler.QueryDatapoints(".*002.*") {
|
for i, o := range dmaHandler.DBM.QueryDatapoints(1, uuid.Nil, "Test:A:000") {
|
||||||
// fmt.Println(600, i, o)
|
|
||||||
// }
|
|
||||||
|
|
||||||
for i, o := range dmaHandler.QueryDatapoints(1, "Test:A:000") {
|
|
||||||
fmt.Println(600, i, o)
|
fmt.Println(600, i, o)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,7 +106,7 @@ func TestUpdateDps(t *testing.T) {
|
|||||||
KeyFile: "./cert/key.pem",
|
KeyFile: "./cert/key.pem",
|
||||||
},
|
},
|
||||||
RootDir: ".",
|
RootDir: ".",
|
||||||
DMAFile: "Test",
|
DBMFile: "Test",
|
||||||
Debug: false,
|
Debug: false,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -121,17 +118,17 @@ func TestUpdateDps(t *testing.T) {
|
|||||||
ndps := utils.ListofA2ZZ()
|
ndps := utils.ListofA2ZZ()
|
||||||
l := len(ndps)
|
l := len(ndps)
|
||||||
s := time.Now()
|
s := time.Now()
|
||||||
for j, dp := range ndps {
|
// for j, dp := range ndps {
|
||||||
if j > 2 {
|
// if j > 2 {
|
||||||
break
|
// break
|
||||||
}
|
// }
|
||||||
for i := 0; i < 100; i++ {
|
// for i := 0; i < 100; i++ {
|
||||||
err = dmaHandler.UpdateDatapointValue(fmt.Sprintf("Test:%s:%03d", dp, i), rand.Int31())
|
// err = dmaHandler.UpdateDatapointValue(fmt.Sprintf("Test:%s:%03d", dp, i), rand.Int31())
|
||||||
if err != nil {
|
// if err != nil {
|
||||||
t.Fatal(err)
|
// t.Fatal(err)
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
fmt.Printf("time used to update %d datapoints: %v\n", l*100, time.Since(s))
|
fmt.Printf("time used to update %d datapoints: %v\n", l*100, time.Since(s))
|
||||||
|
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
@@ -145,7 +142,7 @@ func TestUpdateDps(t *testing.T) {
|
|||||||
|
|
||||||
func TestServer(t *testing.T) {
|
func TestServer(t *testing.T) {
|
||||||
fmt.Println("start")
|
fmt.Println("start")
|
||||||
server := server.NewServer()
|
server := ws.NewServer([]string{".*"}, 9500)
|
||||||
|
|
||||||
t.Fatal(server.ServeHttp(8100))
|
t.Fatal(server.ServeHttp("http://localhost", 8100))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
package test
|
|
||||||
|
|
||||||
import (
|
|
||||||
"math/rand"
|
|
||||||
|
|
||||||
"github.com/zuadi/tecamino-dbm/models"
|
|
||||||
)
|
|
||||||
|
|
||||||
func RandomType() models.Type {
|
|
||||||
n := rand.Intn(11) + 1
|
|
||||||
|
|
||||||
switch n {
|
|
||||||
case 1:
|
|
||||||
return "BIT"
|
|
||||||
case 2:
|
|
||||||
return "BYU"
|
|
||||||
case 3:
|
|
||||||
return "BYS"
|
|
||||||
case 4:
|
|
||||||
return "WOS"
|
|
||||||
case 5:
|
|
||||||
return "WOU"
|
|
||||||
case 6:
|
|
||||||
return "DWS"
|
|
||||||
case 7:
|
|
||||||
return "DWU"
|
|
||||||
case 8:
|
|
||||||
return "LOS"
|
|
||||||
case 9:
|
|
||||||
return "LOU"
|
|
||||||
case 10:
|
|
||||||
return "F32"
|
|
||||||
case 11:
|
|
||||||
return "F64"
|
|
||||||
case 12:
|
|
||||||
return "STRING"
|
|
||||||
default:
|
|
||||||
return "NONE"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
70906
test/test.dma
70906
test/test.dma
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// return any input type to float32
|
||||||
func Float32From(v any) float32 {
|
func Float32From(v any) float32 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -44,6 +45,7 @@ func Float32From(v any) float32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to float64
|
||||||
func Float64From(v any) float64 {
|
func Float64From(v any) float64 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -83,6 +85,7 @@ func Float64From(v any) float64 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to int8
|
||||||
func Int8From(v any) int8 {
|
func Int8From(v any) int8 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -122,6 +125,7 @@ func Int8From(v any) int8 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to int16
|
||||||
func Int16From(v any) int16 {
|
func Int16From(v any) int16 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -161,6 +165,7 @@ func Int16From(v any) int16 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to int32
|
||||||
func Int32From(v any) int32 {
|
func Int32From(v any) int32 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -200,6 +205,7 @@ func Int32From(v any) int32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to int64
|
||||||
func Int64From(v any) int64 {
|
func Int64From(v any) int64 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -239,6 +245,7 @@ func Int64From(v any) int64 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to int
|
||||||
func Uint8From(v any) uint8 {
|
func Uint8From(v any) uint8 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -278,6 +285,7 @@ func Uint8From(v any) uint8 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to uint16
|
||||||
func Uint16From(v any) uint16 {
|
func Uint16From(v any) uint16 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -317,6 +325,7 @@ func Uint16From(v any) uint16 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to uint32
|
||||||
func Uint32From(v any) uint32 {
|
func Uint32From(v any) uint32 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -356,6 +365,7 @@ func Uint32From(v any) uint32 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to uint64
|
||||||
func Uint64From(v any) uint64 {
|
func Uint64From(v any) uint64 {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
@@ -395,6 +405,7 @@ func Uint64From(v any) uint64 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// return any input type to bool
|
||||||
func BoolFrom(v any) bool {
|
func BoolFrom(v any) bool {
|
||||||
switch val := v.(type) {
|
switch val := v.(type) {
|
||||||
case bool:
|
case bool:
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
package utils
|
package utils
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"net"
|
||||||
|
)
|
||||||
|
|
||||||
func ListofA2ZZ() (list []string) {
|
func ListofA2ZZ() (list []string) {
|
||||||
for i := 'A'; i <= 'Z'; i++ {
|
for i := 'A'; i <= 'Z'; i++ {
|
||||||
list = append(list, string(i))
|
list = append(list, string(i))
|
||||||
@@ -9,12 +14,21 @@ func ListofA2ZZ() (list []string) {
|
|||||||
list = append(list, string(i)+string(j))
|
list = append(list, string(i)+string(j))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// for i := 'A'; i <= 'Z'; i++ {
|
|
||||||
// for j := 'A'; j <= 'Z'; j++ {
|
|
||||||
// for k := 'A'; k <= 'Z'; k++ {
|
|
||||||
// list = append(list, string(i)+string(j)+string(k))
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetLocalIP() (string, error) {
|
||||||
|
addrs, err := net.InterfaceAddrs()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, addr := range addrs {
|
||||||
|
if ipNet, ok := addr.(*net.IPNet); ok && !ipNet.IP.IsLoopback() {
|
||||||
|
if ipNet.IP.To4() != nil {
|
||||||
|
return ipNet.IP.String(), nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "", fmt.Errorf("no local IP address found")
|
||||||
|
}
|
||||||
|
|||||||
76
websocket/clientHandler.go
Normal file
76
websocket/clientHandler.go
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
package websocket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"sync"
|
||||||
|
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-dbm/websocket/models"
|
||||||
|
wsModels "gitea.tecamino.com/paadi/tecamino-dbm/websocket/models"
|
||||||
|
json_dataModels "gitea.tecamino.com/paadi/tecamino-json_data/models"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// serves as connection handler of websocket
|
||||||
|
type ClientHandler struct {
|
||||||
|
sync.RWMutex
|
||||||
|
Clients models.Clients
|
||||||
|
}
|
||||||
|
|
||||||
|
func SendBroadcast(msg []byte) {
|
||||||
|
for _, c := range models.Broadcast {
|
||||||
|
c.SendResponse(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// initaiates new conections with client map
|
||||||
|
func NewConnectionHandler() *ClientHandler {
|
||||||
|
return &ClientHandler{
|
||||||
|
Clients: make(models.Clients),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Connect a recieving websocket connection
|
||||||
|
func (cH *ClientHandler) ConnectNewClient(id string, c *gin.Context) (client *models.Client, err error) {
|
||||||
|
if _, exists := cH.Clients[id]; exists {
|
||||||
|
return cH.Clients[id], nil
|
||||||
|
}
|
||||||
|
|
||||||
|
client, err = models.ConnectNewClient(id, c)
|
||||||
|
client.OnClose = func(code int, reason string) {
|
||||||
|
delete(cH.Clients, id)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
cH.Lock()
|
||||||
|
cH.Clients[id] = client
|
||||||
|
cH.Unlock()
|
||||||
|
return client, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// get client client
|
||||||
|
func (c *ClientHandler) GetClient(id string) *wsModels.Client {
|
||||||
|
if client, ok := c.Clients[id]; ok {
|
||||||
|
return client
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// sends json response to client
|
||||||
|
func (c *ClientHandler) SendResponse(id string, r *json_dataModels.Response) error {
|
||||||
|
client, ok := c.Clients[id]
|
||||||
|
if !ok {
|
||||||
|
return fmt.Errorf("client not found for id %s", id)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
b, err := json.Marshal(*r)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
client.SendResponse(b)
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
226
websocket/models/client.go
Normal file
226
websocket/models/client.go
Normal file
@@ -0,0 +1,226 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"net/http"
|
||||||
|
"slices"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/gorilla/websocket"
|
||||||
|
)
|
||||||
|
|
||||||
|
var Origins []string = []string{"*"}
|
||||||
|
|
||||||
|
var Broadcast Clients = make(Clients)
|
||||||
|
|
||||||
|
const (
|
||||||
|
// Time allowed to write a message to the peer.
|
||||||
|
writeWait = 10 * time.Second
|
||||||
|
|
||||||
|
// Time allowed to read the next pong message from the peer.
|
||||||
|
pongWait = 30 * time.Second
|
||||||
|
|
||||||
|
// Send pings to peer with this period. Must be less than pongWait.
|
||||||
|
pingPeriod = (pongWait * 9) / 10
|
||||||
|
)
|
||||||
|
|
||||||
|
type Client struct {
|
||||||
|
Id string
|
||||||
|
Connected bool `json:"connected"`
|
||||||
|
conn *websocket.Conn `json:"-"`
|
||||||
|
OnOpen func()
|
||||||
|
OnMessage func(data []byte)
|
||||||
|
OnClose func(code int, reason string)
|
||||||
|
OnError func(err error)
|
||||||
|
OnWarning func(warn string)
|
||||||
|
OnPing func()
|
||||||
|
OnPong func()
|
||||||
|
send chan []byte
|
||||||
|
unregister chan []byte
|
||||||
|
}
|
||||||
|
|
||||||
|
var upgrader = websocket.Upgrader{
|
||||||
|
CheckOrigin: func(r *http.Request) bool {
|
||||||
|
if len(Origins) == 0 {
|
||||||
|
return false
|
||||||
|
} else if Origins[0] == "*" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return slices.Contains(Origins, r.Header.Get("Origin"))
|
||||||
|
},
|
||||||
|
EnableCompression: false,
|
||||||
|
}
|
||||||
|
|
||||||
|
func ConnectNewClient(id string, c *gin.Context) (*Client, error) {
|
||||||
|
conn, err := upgrader.Upgrade(c.Writer, c.Request, nil)
|
||||||
|
if err != nil {
|
||||||
|
return nil, fmt.Errorf("websocket upgrade error: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
client := &Client{
|
||||||
|
Id: id,
|
||||||
|
Connected: true,
|
||||||
|
conn: conn,
|
||||||
|
send: make(chan []byte, 512),
|
||||||
|
unregister: make(chan []byte, 256),
|
||||||
|
}
|
||||||
|
|
||||||
|
Broadcast[client.Id] = client
|
||||||
|
|
||||||
|
conn.SetReadDeadline(time.Now().Add(pongWait))
|
||||||
|
|
||||||
|
conn.SetPingHandler(func(appData string) error {
|
||||||
|
if client.OnPing != nil {
|
||||||
|
client.OnPing()
|
||||||
|
}
|
||||||
|
|
||||||
|
conn.SetReadDeadline(time.Now().Add(pongWait))
|
||||||
|
conn.SetWriteDeadline(time.Now().Add(writeWait))
|
||||||
|
if err := client.conn.WriteControl(websocket.PongMessage, []byte(appData), time.Now().Add(pongWait)); err != nil {
|
||||||
|
client.OnError(err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
conn.SetPongHandler(func(appData string) error {
|
||||||
|
conn.SetReadDeadline(time.Now().Add(pongWait))
|
||||||
|
if client.OnPong != nil {
|
||||||
|
client.OnPong()
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
|
||||||
|
// Start reading messages from client
|
||||||
|
go client.Read()
|
||||||
|
go client.Write()
|
||||||
|
go client.PingInterval(pingPeriod)
|
||||||
|
return client, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) Read() {
|
||||||
|
if c.OnOpen != nil {
|
||||||
|
c.OnOpen()
|
||||||
|
}
|
||||||
|
|
||||||
|
c.conn.SetReadDeadline(time.Now().Add(writeWait))
|
||||||
|
for c.Connected {
|
||||||
|
msgType, msg, err := c.conn.ReadMessage()
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
c.handleError(fmt.Errorf("read error (id:%s): %w", c.Id, err))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
switch msgType {
|
||||||
|
case websocket.CloseMessage:
|
||||||
|
c.Close(websocket.CloseNormalClosure, "Client closed")
|
||||||
|
return
|
||||||
|
case websocket.TextMessage:
|
||||||
|
if c.OnMessage != nil {
|
||||||
|
c.OnMessage(msg)
|
||||||
|
} else {
|
||||||
|
log.Printf("Received message but no handler set (id:%s): %s", c.Id, string(msg))
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
log.Printf("Unhandled message type %d (id:%s)", msgType, c.Id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) Write() {
|
||||||
|
defer c.conn.Close()
|
||||||
|
|
||||||
|
for {
|
||||||
|
select {
|
||||||
|
case message, ok := <-c.send:
|
||||||
|
c.conn.SetWriteDeadline(time.Now().Add(writeWait))
|
||||||
|
if !ok {
|
||||||
|
// The hub closed the channel.
|
||||||
|
if err := c.conn.WriteMessage(websocket.CloseMessage, []byte("ping")); err != nil {
|
||||||
|
c.handleError(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
c.handleError(fmt.Errorf("server %s closed channel", c.Id))
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
if err := c.conn.WriteMessage(websocket.TextMessage, message); err != nil {
|
||||||
|
c.handleError(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case message := <-c.unregister:
|
||||||
|
c.conn.WriteMessage(websocket.CloseMessage, message)
|
||||||
|
c.Connected = false
|
||||||
|
close(c.send)
|
||||||
|
delete(Broadcast, c.Id)
|
||||||
|
close(c.unregister)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) PingInterval(interval time.Duration) {
|
||||||
|
ticker := time.NewTicker(interval)
|
||||||
|
defer ticker.Stop()
|
||||||
|
|
||||||
|
if err := c.conn.WriteControl(websocket.PingMessage, []byte("ping"), time.Now().Add(pongWait)); err != nil {
|
||||||
|
c.OnError(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for range ticker.C {
|
||||||
|
if c.OnPing != nil {
|
||||||
|
c.OnPing()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := c.conn.WriteControl(websocket.PingMessage, []byte("ping"), time.Now().Add(pongWait)); err != nil {
|
||||||
|
c.OnError(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) SendResponse(data []byte) {
|
||||||
|
if !c.Connected {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
select {
|
||||||
|
case c.send <- data:
|
||||||
|
// sent successfully
|
||||||
|
default:
|
||||||
|
// channel full, drop or log
|
||||||
|
if c.OnWarning != nil {
|
||||||
|
c.OnWarning("Dropping message: channel full")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) Close(code int, reason string) error {
|
||||||
|
closeMsg := websocket.FormatCloseMessage(code, reason)
|
||||||
|
|
||||||
|
select {
|
||||||
|
case c.unregister <- closeMsg: // Attempt to send
|
||||||
|
default: // If the channel is full, this runs
|
||||||
|
return fmt.Errorf("attempt close client socket failed")
|
||||||
|
}
|
||||||
|
if c.OnClose != nil {
|
||||||
|
c.OnClose(code, reason)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Client) handleError(err error) {
|
||||||
|
if c.OnError != nil {
|
||||||
|
c.OnError(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := c.Close(websocket.CloseInternalServerErr, err.Error()); err != nil {
|
||||||
|
if c.OnError != nil {
|
||||||
|
c.OnError(err)
|
||||||
|
} else {
|
||||||
|
fmt.Println("error: ", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
websocket/models/clients.go
Normal file
3
websocket/models/clients.go
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
type Clients map[string]*Client
|
||||||
21
websocket/models/wsMessage.go
Normal file
21
websocket/models/wsMessage.go
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
import "encoding/json"
|
||||||
|
|
||||||
|
type WSMessage struct {
|
||||||
|
Type string `json:"type"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetPongByteSlice() []byte {
|
||||||
|
b, err := json.Marshal(WSMessage{
|
||||||
|
Type: "pong",
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return []byte{}
|
||||||
|
}
|
||||||
|
return b
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w WSMessage) IsPing() bool {
|
||||||
|
return w.Type == "ping"
|
||||||
|
}
|
||||||
60
websocket/server.go
Normal file
60
websocket/server.go
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
package websocket
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"sync"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-dbm/cert"
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-dbm/utils"
|
||||||
|
"gitea.tecamino.com/paadi/tecamino-logger/logging"
|
||||||
|
"github.com/gin-contrib/cors"
|
||||||
|
"github.com/gin-gonic/gin"
|
||||||
|
)
|
||||||
|
|
||||||
|
// server model for database manager websocket
|
||||||
|
type Server struct {
|
||||||
|
Routes *gin.Engine
|
||||||
|
sync.RWMutex
|
||||||
|
Logger *logging.Logger
|
||||||
|
}
|
||||||
|
|
||||||
|
// initalizes new dbm server
|
||||||
|
func NewServer(allowOrigins []string, port uint) *Server {
|
||||||
|
r := gin.Default()
|
||||||
|
|
||||||
|
allowOrigins = append(allowOrigins, fmt.Sprintf("http://localhost:%d", port))
|
||||||
|
|
||||||
|
localIP, err := utils.GetLocalIP()
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("get local ip : %s", err.Error())
|
||||||
|
} else {
|
||||||
|
allowOrigins = append(allowOrigins, fmt.Sprintf("http://%s:%d", localIP, port))
|
||||||
|
}
|
||||||
|
r.Use(cors.New(cors.Config{
|
||||||
|
AllowOrigins: allowOrigins,
|
||||||
|
AllowMethods: []string{"GET", "POST", "PUT", "DELETE", "OPTIONS"},
|
||||||
|
AllowHeaders: []string{"Origin", "Content-Type", "Accept"},
|
||||||
|
ExposeHeaders: []string{"Content-Length"},
|
||||||
|
AllowCredentials: true,
|
||||||
|
MaxAge: 12 * time.Hour,
|
||||||
|
}))
|
||||||
|
return &Server{
|
||||||
|
Routes: r,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// serve dbm as http
|
||||||
|
func (s *Server) ServeHttp(ip string, port uint) error {
|
||||||
|
return s.Routes.Run(fmt.Sprintf("%s:%d", ip, port))
|
||||||
|
}
|
||||||
|
|
||||||
|
// serve dbm as http
|
||||||
|
func (s *Server) ServeHttps(ip string, port uint, cert cert.Cert) error {
|
||||||
|
// generate self signed tls certificate
|
||||||
|
if err := cert.GenerateSelfSignedCert(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return s.Routes.RunTLS(fmt.Sprintf("%s:%d", ip, port), cert.CertFile, cert.KeyFile)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user