sync: 同步 v1.0.4 并脱敏配置与镜像
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// package convert
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package convert
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// package excel
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package excel
|
||||
|
||||
|
||||
@@ -83,8 +83,8 @@ func TestSMTPSuccessAndRejectedRecipient(t *testing.T) {
|
||||
}
|
||||
})
|
||||
err := SendSMTP(context.Background(), SMTPOptions{
|
||||
Address: address, Host: "localhost", From: "sender@example.com",
|
||||
To: []string{"recipient@example.com"}, Data: []byte("Subject: test\r\n\r\nmessage\r\n"), Timeout: time.Second,
|
||||
Address: address, Host: "localhost", From: "xxx@example.com",
|
||||
To: []string{"xxx@example.com"}, Data: []byte("Subject: test\r\n\r\nmessage\r\n"), Timeout: time.Second,
|
||||
})
|
||||
if (err != nil) != reject {
|
||||
t.Fatalf("unexpected SMTP result: rejected=%t error=%v", reject, err)
|
||||
@@ -120,8 +120,8 @@ func TestSMTPTimeoutInterruptsGreetingTLSAndProtocol(t *testing.T) {
|
||||
})
|
||||
started := time.Now()
|
||||
err := SendSMTP(context.Background(), SMTPOptions{
|
||||
Address: address, Host: "localhost", SSL: scenario == "tls", From: "sender@example.com",
|
||||
To: []string{"recipient@example.com"}, Data: []byte("message"), Timeout: 70 * time.Millisecond,
|
||||
Address: address, Host: "localhost", SSL: scenario == "tls", From: "xxx@example.com",
|
||||
To: []string{"xxx@example.com"}, Data: []byte("message"), Timeout: 70 * time.Millisecond,
|
||||
})
|
||||
if err == nil || time.Since(started) > time.Second {
|
||||
t.Fatalf("SMTP stall was not interrupted: %v", err)
|
||||
|
||||
@@ -31,7 +31,7 @@ type Redis struct {
|
||||
|
||||
// Config is redis configuration.
|
||||
type Config struct {
|
||||
// Address It supports single and cluster redis server. Multiple addresses joined with char ','. Eg: 192.0.2.1:6379, 192.0.2.2:6379.
|
||||
// Address It supports single and cluster redis server. Multiple addresses joined with char ','. Eg: 127.0.0.1:6379, 127.0.0.1:6379.
|
||||
Address string `json:"address"`
|
||||
Db int `json:"db"` // Redis db.
|
||||
User string `json:"user"` // Username for AUTH.
|
||||
|
||||
@@ -156,7 +156,7 @@ func TestAsyncIPLookupLimitsConcurrentQueries(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCityByIPSkipsPrivateAndInvalidAddresses(t *testing.T) {
|
||||
for _, ip := range []string{"127.0.0.1", "[::1]", "::1", "10.1.2.3", "172.23.0.6", "192.168.100.29", "fe80::1", "0.0.0.0"} {
|
||||
for _, ip := range []string{"127.0.0.1", "[::1]", "::1", "127.0.0.1", "127.0.0.1", "127.0.0.1", "fe80::1", "0.0.0.0"} {
|
||||
if got := GetCityByIp(ip); got != "内网IP" {
|
||||
t.Errorf("%s: got %q", ip, got)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package queue
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
_ "github.com/gogf/gf/contrib/nosql/redis/v2"
|
||||
"github.com/gogf/gf/v2/os/gctx"
|
||||
)
|
||||
|
||||
type testMemoryConsumer struct {
|
||||
}
|
||||
|
||||
func (c *testMemoryConsumer) GetTopic() string {
|
||||
return "test"
|
||||
}
|
||||
|
||||
func (c *testMemoryConsumer) GetType() QueueType {
|
||||
return QueueTypeMemory
|
||||
}
|
||||
|
||||
func (c *testMemoryConsumer) Handle(ctx context.Context, p Payload) error {
|
||||
fmt.Println("testMemoryConsumer", p)
|
||||
return nil
|
||||
}
|
||||
|
||||
type testRedisConsumer struct {
|
||||
QueueType QueueType
|
||||
}
|
||||
|
||||
func (c *testRedisConsumer) GetTopic() string {
|
||||
return "test"
|
||||
}
|
||||
|
||||
func (c *testRedisConsumer) GetType() QueueType {
|
||||
return c.QueueType
|
||||
}
|
||||
|
||||
func (c *testRedisConsumer) Handle(ctx context.Context, p Payload) error {
|
||||
fmt.Printf("testRedisConsumer %+v \n", p)
|
||||
var data string
|
||||
json.Unmarshal(p.Data, &data)
|
||||
fmt.Printf("testRedisConsumer %+v \n", data)
|
||||
|
||||
time.Sleep(1 * time.Second)
|
||||
return nil
|
||||
}
|
||||
|
||||
func TestQueue(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
NewProducer(ctx, QueueTypeMemory, "test", nil)
|
||||
NewConsumer(ctx, &testMemoryConsumer{}, nil)
|
||||
Push(ctx, "test", "content1")
|
||||
Push(ctx, "test", "content2")
|
||||
Push(ctx, "test", "content3")
|
||||
time.Sleep(1 * time.Second)
|
||||
}
|
||||
|
||||
func TestRedisQueue(t *testing.T) {
|
||||
ctx := gctx.New()
|
||||
|
||||
NewProducer(ctx, QueueTypeRedis, "test", &Config{
|
||||
RedisName: "default",
|
||||
})
|
||||
NewConsumer(ctx, &testRedisConsumer{QueueType: QueueTypeRedis}, &Config{
|
||||
RedisName: "default",
|
||||
})
|
||||
time.Sleep(2 * time.Second)
|
||||
Push(ctx, "test", "content1")
|
||||
Push(ctx, "test", "content2")
|
||||
Push(ctx, "test", "content3")
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
|
||||
func TestRedisBroadcast(t *testing.T) {
|
||||
ctx := gctx.New()
|
||||
NewProducer(ctx, QueueTypeRedisBroadcast, "test", &Config{
|
||||
RedisName: "default",
|
||||
})
|
||||
consumerHandle := &testRedisConsumer{QueueType: QueueTypeRedisBroadcast}
|
||||
NewConsumer(ctx, consumerHandle, &Config{
|
||||
RedisName: "default",
|
||||
ClientId: "group1",
|
||||
})
|
||||
NewConsumer(ctx, consumerHandle, &Config{
|
||||
RedisName: "default",
|
||||
ClientId: "group2",
|
||||
})
|
||||
Push(ctx, "test", "content1")
|
||||
Push(ctx, "test", "content2")
|
||||
Push(ctx, "test", "content3")
|
||||
time.Sleep(50 * time.Second)
|
||||
UnregisterConsumer(ctx, "test", "group1")
|
||||
UnregisterConsumer(ctx, "test", "group2")
|
||||
UnregisterProducer(ctx, "test")
|
||||
time.Sleep(5 * time.Second)
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
// package tree
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package tree
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// package utility
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package utility
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// package version
|
||||
// @Link https://github.com/xiujiecn/xiu-admin
|
||||
// @Copyright Copyright (c) 2025 LiXiujie
|
||||
// @Author Lxj <li@xiujie.cn>
|
||||
// @Author Lxj <xxx@example.com>
|
||||
// @License https://github.com/xiujiecn/xiu-admin/blob/master/LICENSE
|
||||
package version
|
||||
|
||||
@@ -24,20 +24,14 @@ func ShowLogo(buildVersion, buildTime, commitID string) {
|
||||
CommitID = commitID
|
||||
//版本号
|
||||
|
||||
fmt.Println(`
|
||||
██╗██╗███████╗ ██╗ ██████╗ ████████╗
|
||||
██║██║██╔════╝ ██║██╔═══██╗╚══██╔══╝
|
||||
██║██║█████╗ ██║██║ ██║ ██║
|
||||
██ ██║██║██╔══╝ ██║██║ ██║ ██║
|
||||
╚█████╔╝██║███████╗ ██║╚██████╔╝ ██║
|
||||
╚════╝ ╚═╝╚══════╝ ╚═╝ ╚═════╝ ╚═╝`)
|
||||
fmt.Println(" __ __ _ _ _ _ \n \\ \\/ /(_) _ _ / \\ __| | _ __ ___ (_) _ __ \n \\ / | || | | | / _ \\ / _` || '_ ` _ \\ | || '_ \\ \n / \\ | || |_| | / ___ \\| (_| || | | | | || || | | |\n /_/\\_\\|_| \\__,_| /_/ \\_\\\\__,_||_| |_| |_||_||_| |_|")
|
||||
fmt.Println("")
|
||||
|
||||
fmt.Println("Version :", buildVersion)
|
||||
fmt.Println("BuildTime :", buildTime)
|
||||
fmt.Println("CommitID :", commitID)
|
||||
fmt.Println("")
|
||||
fmt.Println("Copyright:", "2026 The iotLCM Authors")
|
||||
fmt.Println("Copyright:", "XiuJieZhiLian Technology Co.,Ltd")
|
||||
}
|
||||
|
||||
func AppName(ctx context.Context) string {
|
||||
|
||||
Reference in New Issue
Block a user