diff --git a/component/rulex_api_server/server/www/index.html b/component/rulex_api_server/server/www/index.html
new file mode 100644
index 000000000..70c2640cc
--- /dev/null
+++ b/component/rulex_api_server/server/www/index.html
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+ rulex
+
+
+
+
+
+ Hello
+
+
+
\ No newline at end of file
diff --git a/engine/runner.go b/engine/runner.go
index dc66e9940..6ab356238 100644
--- a/engine/runner.go
+++ b/engine/runner.go
@@ -34,7 +34,6 @@ import (
"github.com/hootrhino/rulex/core"
"github.com/hootrhino/rulex/glogger"
icmpsender "github.com/hootrhino/rulex/plugin/icmp_sender"
- license_manager "github.com/hootrhino/rulex/plugin/license_manager"
"github.com/hootrhino/rulex/typex"
)
@@ -69,11 +68,6 @@ func RunRulex(iniPath string) {
glogger.GLogger.Error(err)
return
}
- license_manager := license_manager.NewLicenseManager(engine)
- if err := engine.LoadPlugin("plugin.license_manager", license_manager); err != nil {
- glogger.GLogger.Error(err)
- return
- }
// Load Plugin
loadPlugin(engine)
diff --git a/go.mod b/go.mod
index cfb408b0a..8ca092a4f 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,8 @@
module github.com/hootrhino/rulex
-go 1.18
+go 1.21
+
+toolchain go1.22.2
require (
github.com/BeatTime/bacnet v0.2.1
diff --git a/plugin/license_manager/license_manager.go b/plugin/license_manager/license_manager.go
deleted file mode 100644
index 858c14e07..000000000
--- a/plugin/license_manager/license_manager.go
+++ /dev/null
@@ -1,108 +0,0 @@
-package licensemanager
-
-/*
-*
-* 证书管理器
- */
-
-import (
- "fmt"
- "os"
-
- "github.com/hootrhino/rulex/glogger"
- "github.com/hootrhino/rulex/typex"
- "gopkg.in/ini.v1"
-)
-
-// LicenseManager 证书管理
-type LicenseManager struct {
- uuid string
- CpuId string
- EthMac string
- AdminUsername string
- AdminPassword string
-}
-
-/*
-*
-* 开源版本默认是给一个授权证书
-*
- */
-func NewLicenseManager(r typex.RuleX) *LicenseManager {
- return &LicenseManager{
- uuid: "LicenseManager",
- AdminUsername: "rhino",
- AdminPassword: "hoot",
- CpuId: "o:p:e:n:r:h:i:n:o",
- EthMac: "o:p:e:n:h:o:o:t",
- }
-}
-
-func (l *LicenseManager) Init(section *ini.Section) error {
- license_path, err1 := section.GetKey("license_path")
- errMsg := "Load License Public Cipher Failed, May be Your License IS Invalid."
- if err1 != nil {
- glogger.GLogger.Fatal()
- os.Exit(0)
- }
- license_key, err2 := section.GetKey("key_path")
- if err2 != nil {
- glogger.GLogger.Fatal(errMsg)
- os.Exit(0)
- }
- lic, err1 := os.ReadFile(license_path.String())
- if err1 != nil {
- glogger.GLogger.Fatal(errMsg)
- os.Exit(0)
- }
- license := string(lic)
- key, err2 := os.ReadFile(license_key.String())
- if err2 != nil {
- glogger.GLogger.Fatal(errMsg)
- os.Exit(0)
- }
- private := string(key)
- localMacSum := SumMd5(fmt.Sprintf("%s,%s", l.CpuId, l.EthMac))
- localAdminSum := SumMd5(fmt.Sprintf("%s,%s", l.AdminUsername, l.AdminPassword))
- adminSalt, err3 := DecryptAES(private, license)
- if err3 != nil {
- glogger.GLogger.Fatal(errMsg)
- os.Exit(0)
- }
- if localAdminSum != private {
- glogger.GLogger.Fatal(errMsg)
- os.Exit(0)
- }
- if adminSalt != localMacSum {
- glogger.GLogger.Fatal(errMsg)
- os.Exit(0)
- }
- glogger.GLogger.Info("Load License Success:", license)
- return nil
-}
-
-// Start 未实现
-func (dm *LicenseManager) Start(typex.RuleX) error {
- return nil
-}
-func (dm *LicenseManager) Service(arg typex.ServiceArg) typex.ServiceResult {
- return typex.ServiceResult{}
-}
-
-// Stop 未实现
-func (dm *LicenseManager) Stop() error {
- return nil
-}
-
-func (hh *LicenseManager) PluginMetaInfo() typex.XPluginMetaInfo {
- return typex.XPluginMetaInfo{
- UUID: hh.uuid,
- Name: "LicenseManager",
- Version: "v0.0.1",
- Homepage: "https://hootrhino.github.io",
- HelpLink: "https://hootrhino.github.io",
- Author: "HootRhinoTeam",
- Email: "HootRhinoTeam@hootrhino.com",
- License: "AGPL",
- }
-}
diff --git a/plugin/license_manager/license_manager.md b/plugin/license_manager/license_manager.md
deleted file mode 100644
index 064d479c4..000000000
--- a/plugin/license_manager/license_manager.md
+++ /dev/null
@@ -1,2 +0,0 @@
-# 固件证书管理器
-固件证书管理器,用来防止盗版或者破解。开源版不限制使用,商业版有单独的证书管理器。
diff --git a/plugin/license_manager/misc.go b/plugin/license_manager/misc.go
deleted file mode 100644
index 642d68307..000000000
--- a/plugin/license_manager/misc.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (C) 2023 wwhai
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as
-// published by the Free Software Foundation, either version 3 of the
-// License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see .
-
-package licensemanager
-
-import (
- "crypto/aes"
- "crypto/cipher"
- "crypto/md5"
- "crypto/rand"
- "encoding/base64"
- "errors"
- "fmt"
- "io"
-)
-
-// encryptAES 加密字符串
-func EncryptAES(key, text string) (string, error) {
- block, err := aes.NewCipher([]byte(key))
- if err != nil {
- return "", err
- }
-
- // 为加密创建一个密码分组模式
- cipherText := make([]byte, aes.BlockSize+len(text))
- iv := cipherText[:aes.BlockSize]
- if _, err := io.ReadFull(rand.Reader, iv); err != nil {
- return "", err
- }
-
- stream := cipher.NewCFBEncrypter(block, iv)
- stream.XORKeyStream(cipherText[aes.BlockSize:], []byte(text))
-
- return base64.URLEncoding.EncodeToString(cipherText), nil
-}
-
-// decryptAES 解密字符串
-func DecryptAES(key, cipherText string) (string, error) {
- block, err := aes.NewCipher([]byte(key))
- if err != nil {
- return "", err
- }
-
- // 使用密文的前 16 个字节作为 IV
- cipherTextBytes, err := base64.URLEncoding.DecodeString(cipherText)
- if err != nil {
- return "", err
- }
-
- if len(cipherTextBytes) < aes.BlockSize {
- return "", errors.New("cipherText is too short")
- }
-
- iv := cipherTextBytes[:aes.BlockSize]
- cipherTextBytes = cipherTextBytes[aes.BlockSize:]
-
- // 创建一个密码分组模式
- stream := cipher.NewCFBDecrypter(block, iv)
-
- // 解密
- stream.XORKeyStream(cipherTextBytes, cipherTextBytes)
-
- return string(cipherTextBytes), nil
-}
-
-/*
-*
-* MD5
-*
- */
-func SumMd5(inputString string) string {
- hasher := md5.New()
- io.WriteString(hasher, inputString)
- hashBytes := hasher.Sum(nil)
- md5String := fmt.Sprintf("%x", hashBytes)
- return md5String
-}