diff --git a/crypto/crypt/Hash.go b/crypto/crypt/Hash.go index d3f2eef..bc68be4 100644 --- a/crypto/crypt/Hash.go +++ b/crypto/crypt/Hash.go @@ -1,13 +1,13 @@ package crypt import ( - "crypto/sha512" + "crypto/sha256" "github.com/ZZMarquis/gm/sm3" "hash" ) func (c *CMCrypt) NewHash() hash.Hash { - return sha512.New() + return sha256.New() } func (c *GMCrypt) NewHash() hash.Hash { @@ -27,4 +27,4 @@ func makeHash(h hash.Hash, data ...[]byte) []byte { h.Write(b) } return h.Sum(nil) -} \ No newline at end of file +} diff --git a/crypto/crypto.go b/crypto/crypto.go index 43f2c68..2122730 100644 --- a/crypto/crypto.go +++ b/crypto/crypto.go @@ -1,8 +1,8 @@ package crypto import ( - "apigo.cloud/git/apigo/plugin" - "apigo.cloud/git/apigo/plugins/crypto/crypt" + "apigo.cc/apigo/plugin" + "apigo.cc/apigo/plugins/crypto/crypt" "crypto/md5" "crypto/sha1" "crypto/sha256" @@ -21,7 +21,7 @@ var defaultCryptoLock = sync.RWMutex{} func init() { plugin.Register(plugin.Plugin{ - Id: "apigo.cloud/git/apigo/plugins/crypto", + Id: "apigo.cc/apigo/plugins/crypto", Name: "加密算法", ConfigSample: `mode: cm # 指定默认算法集,cm-通用算法(SHA256、AES、ECDSA),gm-国密算法(sm3、sm4、sm2)`, Init: func(conf map[string]interface{}) { diff --git a/db/MakeDao.go b/db/MakeDao.go index 051a769..dd669e6 100644 --- a/db/MakeDao.go +++ b/db/MakeDao.go @@ -1,7 +1,7 @@ package db import ( - "apigo.cloud/git/apigo/plugin" + "apigo.cc/apigo/plugin" "bytes" _ "embed" "github.com/ssgo/db" diff --git a/db/MakeTable.go b/db/MakeTable.go index 0deea1b..e44d8c1 100644 --- a/db/MakeTable.go +++ b/db/MakeTable.go @@ -1,7 +1,7 @@ package db import ( - "apigo.cloud/git/apigo/plugin" + "apigo.cc/apigo/plugin" _ "embed" "fmt" "github.com/ssgo/db" diff --git a/db/dao.js b/db/dao.js index fe28d5d..dd1e12b 100644 --- a/db/dao.js +++ b/db/dao.js @@ -1,5 +1,5 @@ -import db from "apigo.cloud/git/apigo/plugins/db" -import redis from "apigo.cloud/git/apigo/plugins/redis" +import db from "apigo.cc/apigo/plugins/db" +import redis from "apigo.cc/apigo/plugins/redis" import logger from "logger" /*{{$dao := . -}}*/ diff --git a/db/db.go b/db/db.go index 8cf7dcd..716b891 100644 --- a/db/db.go +++ b/db/db.go @@ -1,7 +1,7 @@ package db import ( - "apigo.cloud/git/apigo/plugin" + "apigo.cc/apigo/plugin" "fmt" "github.com/ssgo/db" "github.com/ssgo/log" @@ -39,7 +39,7 @@ var configSetLock = sync.RWMutex{} func init() { plugin.Register(plugin.Plugin{ - Id: "apigo.cloud/git/apigo/plugins/db", + Id: "apigo.cc/apigo/plugins/db", Name: "数据库操作", ConfigSample: `default: mysql://root:<**encrypted_password**>@127.0.0.1:3306/1?maxIdles=0&maxLifeTime=0&maxOpens=0&logSlow=1s # set default db connection pool, used by db.xxx configs: diff --git a/file/file.go b/file/file.go index bd51c2f..e4bddc7 100644 --- a/file/file.go +++ b/file/file.go @@ -1,7 +1,7 @@ package file import ( - "apigo.cloud/git/apigo/plugin" + "apigo.cc/apigo/plugin" "bufio" "errors" "github.com/ssgo/u" @@ -36,7 +36,7 @@ type FileInfo struct { func init() { plugin.Register(plugin.Plugin{ - Id: "apigo.cloud/git/apigo/plugins/file", + Id: "apigo.cc/apigo/plugins/file", Name: "文件操作", ConfigSample: `allowPaths: # 允许操作的文件路径 - / diff --git a/go.mod b/go.mod index 4cfa26c..515ae12 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,9 @@ -module apigo.cloud/git/apigo/plugins +module apigo.cc/apigo/plugins go 1.17 require ( - apigo.cloud/git/apigo/plugin v1.0.1 + apigo.cc/apigo/plugin v1.0.2 github.com/ZZMarquis/gm v1.3.2 github.com/emmansun/gmsm v0.21.1 github.com/gorilla/websocket v1.5.1 diff --git a/http/http.go b/http/http.go index 74b1cad..8dbb0d9 100644 --- a/http/http.go +++ b/http/http.go @@ -1,7 +1,7 @@ package http import ( - "apigo.cloud/git/apigo/plugin" + "apigo.cc/apigo/plugin" "errors" "github.com/gorilla/websocket" "github.com/ssgo/httpclient" @@ -26,7 +26,7 @@ var defaultClient = Client{ func init() { defaultClient.pool.EnableRedirect() plugin.Register(plugin.Plugin{ - Id: "apigo.cloud/git/apigo/plugins/http", + Id: "apigo.cc/apigo/plugins/http", Name: "HTTP客户端", Objects: map[string]interface{}{ "new": NewHTTP, diff --git a/redis/redis.go b/redis/redis.go index ea70adc..95fe663 100644 --- a/redis/redis.go +++ b/redis/redis.go @@ -1,7 +1,7 @@ package redis import ( - "apigo.cloud/git/apigo/plugin" + "apigo.cc/apigo/plugin" "encoding/json" "github.com/ssgo/log" "github.com/ssgo/redis" @@ -18,7 +18,7 @@ var configSetLock = sync.RWMutex{} func init() { plugin.Register(plugin.Plugin{ - Id: "apigo.cloud/git/apigo/plugins/redis", + Id: "apigo.cc/apigo/plugins/redis", Name: "Redis客户端", ConfigSample: `default: redis://:<**encrypted_password**>@127.0.0.1:6379/1?timeout=10s&logSlow=100ms # set default redis connection pool, used by redis.xxx configs: diff --git a/runtime/runtime.go b/runtime/runtime.go index 0f9e9cc..e73af31 100644 --- a/runtime/runtime.go +++ b/runtime/runtime.go @@ -1,7 +1,7 @@ package runtime import ( - "apigo.cloud/git/apigo/plugin" + "apigo.cc/apigo/plugin" "github.com/ssgo/u" "runtime" "time" @@ -9,7 +9,7 @@ import ( func init() { plugin.Register(plugin.Plugin{ - Id: "apigo.cloud/git/apigo/plugins/runtime", + Id: "apigo.cc/apigo/plugins/runtime", Name: "运行时支持", Objects: map[string]interface{}{ // sleep 程序等待指定时间 diff --git a/tests/crypto_test.go b/tests/crypto_test.go index b84d778..78c5469 100644 --- a/tests/crypto_test.go +++ b/tests/crypto_test.go @@ -1,8 +1,8 @@ package tests import ( - "apigo.cloud/git/apigo/gojs" - _ "apigo.cloud/git/apigo/plugins/crypto" + "apigo.cc/apigo/gojs" + _ "apigo.cc/apigo/plugins/crypto" "os" "path/filepath" "strings" diff --git a/tests/crypto_tests/aes_test.js b/tests/crypto_tests/aes_test.js index cc14b8f..7ed3221 100644 --- a/tests/crypto_tests/aes_test.js +++ b/tests/crypto_tests/aes_test.js @@ -1,4 +1,4 @@ -import crypto from "apigo.cloud/git/apigo/plugins/crypto" +import crypto from "apigo.cc/apigo/plugins/crypto" let key = "?GQ$0K0GgLdO=f+~L68PLm$uhKr4'=tV" let iv = new Uint8Array([86,70,115,55,64,115,75,54,49,99,106,94,102,63,72,90]) diff --git a/tests/crypto_tests/ecdsa_test.js b/tests/crypto_tests/ecdsa_test.js index c87ee93..1eea115 100644 --- a/tests/crypto_tests/ecdsa_test.js +++ b/tests/crypto_tests/ecdsa_test.js @@ -1,4 +1,4 @@ -import crypto from "apigo.cloud/git/apigo/plugins/crypto" +import crypto from "apigo.cc/apigo/plugins/crypto" let [priKey, pubKey] = crypto.ecdsa.genKey() let s1 = crypto.ecdsa.sign('hello 123', priKey) diff --git a/tests/crypto_tests/hash_test.js b/tests/crypto_tests/hash_test.js index c4b8321..317f0b0 100644 --- a/tests/crypto_tests/hash_test.js +++ b/tests/crypto_tests/hash_test.js @@ -1,4 +1,4 @@ -import crypto from "apigo.cloud/git/apigo/plugins/crypto" +import crypto from "apigo.cc/apigo/plugins/crypto" if(crypto.md5('hello 123') !== '1bb45824de71b2f6476d800f427cb2ab') throw new Error('md5 error') if(crypto.sm3('hello 123') !== '4e1f46e2350250d20df71c360852751c8aed29753e6058969602cea8639f7737') throw new Error('sm3 error') diff --git a/tests/crypto_tests/sm2_test.js b/tests/crypto_tests/sm2_test.js index 6374df1..1d490e8 100644 --- a/tests/crypto_tests/sm2_test.js +++ b/tests/crypto_tests/sm2_test.js @@ -1,4 +1,4 @@ -import crypto from "apigo.cloud/git/apigo/plugins/crypto" +import crypto from "apigo.cc/apigo/plugins/crypto" let [priKey, pubKey] = crypto.sm2.genKey() let s1 = crypto.sm2.sign('hello 123', priKey) diff --git a/tests/crypto_tests/sm4_test.js b/tests/crypto_tests/sm4_test.js index 2356b27..4e557f8 100644 --- a/tests/crypto_tests/sm4_test.js +++ b/tests/crypto_tests/sm4_test.js @@ -1,4 +1,4 @@ -import crypto from "apigo.cloud/git/apigo/plugins/crypto" +import crypto from "apigo.cc/apigo/plugins/crypto" let key = "?GQ$0K0GgLdO=f+~L68PLm$uhKr4'=tV" let iv = new Uint8Array([86,70,115,55,64,115,75,54,49,99,106,94,102,63,72,90]) diff --git a/tests/db_test.go b/tests/db_test.go index 4bdbb7a..a4eec08 100644 --- a/tests/db_test.go +++ b/tests/db_test.go @@ -1,11 +1,11 @@ package tests import ( - "apigo.cloud/git/apigo/gojs" - "apigo.cloud/git/apigo/plugin" - _ "apigo.cloud/git/apigo/plugins/db" - _ "apigo.cloud/git/apigo/plugins/file" - _ "apigo.cloud/git/apigo/plugins/redis" + "apigo.cc/apigo/gojs" + "apigo.cc/apigo/plugin" + _ "apigo.cc/apigo/plugins/db" + _ "apigo.cc/apigo/plugins/file" + _ "apigo.cc/apigo/plugins/redis" _ "github.com/mattn/go-sqlite3" "github.com/ssgo/u" "os" @@ -17,7 +17,7 @@ func T1estSql(t *testing.T) { defer rt.Close() gojs.SetPluginsConfig(map[string]plugin.Config{ - "apigo.cloud/git/apigo/plugins/db": { + "apigo.cc/apigo/plugins/db": { "default": "sqlite3://Test.db", }, }) @@ -53,10 +53,10 @@ func TestDao(t *testing.T) { defer rdServer.Close() gojs.SetPluginsConfig(map[string]plugin.Config{ - "apigo.cloud/git/apigo/plugins/db": { + "apigo.cc/apigo/plugins/db": { "default": "sqlite3://Test.db", }, - "apigo.cloud/git/apigo/plugins/redis": { + "apigo.cc/apigo/plugins/redis": { "default": "redis://localhost:16379", }, }) diff --git a/tests/db_tests/dao_init.js b/tests/db_tests/dao_init.js index 8f8ec9d..7c41b0f 100644 --- a/tests/db_tests/dao_init.js +++ b/tests/db_tests/dao_init.js @@ -1,5 +1,5 @@ -import db from "apigo.cloud/git/apigo/plugins/db" -import file from "apigo.cloud/git/apigo/plugins/file" +import db from "apigo.cc/apigo/plugins/db" +import file from "apigo.cc/apigo/plugins/file" let testDBDesc = file.loadYaml('./TestDB.yml') db.make(testDBDesc) diff --git a/tests/db_tests/dao_test.js b/tests/db_tests/dao_test.js index 3c899be..8599f66 100644 --- a/tests/db_tests/dao_test.js +++ b/tests/db_tests/dao_test.js @@ -1,5 +1,5 @@ import {TestDao} from "./TestDao" -import file from "apigo.cloud/git/apigo/plugins/file" +import file from "apigo.cc/apigo/plugins/file" function testInsert() { let dao = new TestDao() diff --git a/tests/db_tests/db_test.js b/tests/db_tests/db_test.js index be01c9c..6d9d1f7 100644 --- a/tests/db_tests/db_test.js +++ b/tests/db_tests/db_test.js @@ -1,5 +1,5 @@ -import db from "apigo.cloud/git/apigo/plugins/db" -import file from "apigo.cloud/git/apigo/plugins/file" +import db from "apigo.cc/apigo/plugins/db" +import file from "apigo.cc/apigo/plugins/file" db.make(file.loadYaml('./TestDB.yml')) diff --git a/tests/file_test.go b/tests/file_test.go index 1748234..f697231 100644 --- a/tests/file_test.go +++ b/tests/file_test.go @@ -1,9 +1,9 @@ package tests import ( - "apigo.cloud/git/apigo/gojs" - "apigo.cloud/git/apigo/plugin" - _ "apigo.cloud/git/apigo/plugins/file" + "apigo.cc/apigo/gojs" + "apigo.cc/apigo/plugin" + _ "apigo.cc/apigo/plugins/file" "testing" ) @@ -12,7 +12,7 @@ func TestFile(t *testing.T) { defer rt.Close() gojs.SetPluginsConfig(map[string]plugin.Config{ - "apigo.cloud/git/apigo/plugins/file": { + "apigo.cc/apigo/plugins/file": { "allowPaths": []string{ "testData", }, diff --git a/tests/file_test.js b/tests/file_test.js index e5bda16..ff9190c 100644 --- a/tests/file_test.js +++ b/tests/file_test.js @@ -1,4 +1,4 @@ -import file from "apigo.cloud/git/apigo/plugins/file" +import file from "apigo.cc/apigo/plugins/file" try { file.write('testData/aaa.txt', '123') diff --git a/tests/go.mod b/tests/go.mod index 298fbf1..34da633 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -1,13 +1,11 @@ module tests -go 1.22 - -toolchain go1.22.1 +go 1.17 require ( - apigo.cloud/git/apigo/gojs v0.0.8 - apigo.cloud/git/apigo/plugin v1.0.1 - apigo.cloud/git/apigo/plugins v0.0.0 + apigo.cc/apigo/gojs v0.0.9 + apigo.cc/apigo/plugin v1.0.2 + apigo.cc/apigo/plugins v0.0.0 github.com/mattn/go-sqlite3 v1.14.18 github.com/ssgo/s v1.7.5 github.com/ssgo/u v1.7.5 @@ -15,7 +13,7 @@ require ( ) require ( - apigo.cloud/git/apigo/qjs v0.0.1 // indirect + apigo.cc/apigo/qjs v0.0.3 // indirect github.com/ZZMarquis/gm v1.3.2 // indirect github.com/emmansun/gmsm v0.21.1 // indirect github.com/go-ole/go-ole v1.2.6 // indirect @@ -47,4 +45,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace apigo.cloud/git/apigo/plugins v0.0.0 => ../ +replace apigo.cc/apigo/plugins v0.0.0 => ../ diff --git a/tests/http_test.go b/tests/http_test.go index 051c738..16b6689 100644 --- a/tests/http_test.go +++ b/tests/http_test.go @@ -1,8 +1,8 @@ package tests import ( - "apigo.cloud/git/apigo/gojs" - _ "apigo.cloud/git/apigo/plugins/http" + "apigo.cc/apigo/gojs" + _ "apigo.cc/apigo/plugins/http" "github.com/ssgo/s" "os" "path/filepath" @@ -50,14 +50,14 @@ func TestH2C(t *testing.T) { rt.JsCtx.Globals().Set("server", rt.JsCtx.String(as.Addr)) _, err := rt.Run(` - import http from "apigo.cloud/git/apigo/plugins/http" + import http from "apigo.cc/apigo/plugins/http" http.get('http://'+server+'/echo?aaa=111') `) //fmt.Println(u.BMagenta(err)) Test(t, "get for h2c", err != nil && strings.Contains(err.Error(), "transport connection broken")) r, err := rt.Run(` - import http from "apigo.cloud/git/apigo/plugins/http" + import http from "apigo.cc/apigo/plugins/http" let c = http.newH2C(10) r = c.post('http://'+server+'/echo', {aaa:111}) if(r.data.aaa != 111) throw new Error('aaa is '+r.data.aaa+' not 111') diff --git a/tests/http_tests/get_test.js b/tests/http_tests/get_test.js index 47cf99a..d5262a7 100644 --- a/tests/http_tests/get_test.js +++ b/tests/http_tests/get_test.js @@ -1,4 +1,4 @@ -import http from "apigo.cloud/git/apigo/plugins/http" +import http from "apigo.cc/apigo/plugins/http" let serv = startTestServer('10803') let r = http.get('http://127.0.0.1:10803/echo?aaa=111') diff --git a/tests/http_tests/jump_test.js b/tests/http_tests/jump_test.js index 8b903b2..7e45974 100644 --- a/tests/http_tests/jump_test.js +++ b/tests/http_tests/jump_test.js @@ -1,4 +1,4 @@ -import http from "apigo.cloud/git/apigo/plugins/http" +import http from "apigo.cc/apigo/plugins/http" let serv = startTestServer('10803') let r = http.get('http://127.0.0.1:10803/jump') diff --git a/tests/http_tests/post_test.js b/tests/http_tests/post_test.js index c7b7d12..43ad209 100644 --- a/tests/http_tests/post_test.js +++ b/tests/http_tests/post_test.js @@ -1,4 +1,4 @@ -import http from "apigo.cloud/git/apigo/plugins/http" +import http from "apigo.cc/apigo/plugins/http" let serv = startTestServer('10803') let r = http.post('http://127.0.0.1:10803/echo', {aaa:111}) diff --git a/tests/redis_test.go b/tests/redis_test.go index ba14f25..72ab0e6 100644 --- a/tests/redis_test.go +++ b/tests/redis_test.go @@ -1,9 +1,9 @@ package tests import ( - "apigo.cloud/git/apigo/gojs" - "apigo.cloud/git/apigo/plugin" - _ "apigo.cloud/git/apigo/plugins/redis" + "apigo.cc/apigo/gojs" + "apigo.cc/apigo/plugin" + _ "apigo.cc/apigo/plugins/redis" "testing" ) @@ -12,7 +12,7 @@ func TestRedis(t *testing.T) { defer rdServer.Close() gojs.SetPluginsConfig(map[string]plugin.Config{ - "apigo.cloud/git/apigo/plugins/redis": { + "apigo.cc/apigo/plugins/redis": { "default": "redis://localhost:16378", "configs": map[string]string{ "bak": "redis://localhost:16378/2", diff --git a/tests/redis_test.js b/tests/redis_test.js index 500cee9..7dbb4fc 100644 --- a/tests/redis_test.js +++ b/tests/redis_test.js @@ -1,4 +1,4 @@ -import redis from "apigo.cloud/git/apigo/plugins/redis" +import redis from "apigo.cc/apigo/plugins/redis" redis.set('aaa', 111) let aaa = redis.get('aaa') diff --git a/util/util.go b/util/util.go index 1a14e1b..68ac32b 100644 --- a/util/util.go +++ b/util/util.go @@ -1,8 +1,8 @@ package util import ( + "apigo.cc/apigo/plugin" "encoding/hex" - "apigo.cloud/git/apigo/plugin" "github.com/ssgo/u" "gopkg.in/yaml.v3" )