Skip to content
This repository was archived by the owner on Nov 5, 2024. It is now read-only.

Commit 2cd49da

Browse files
committed
将所有的随机ID从大小写混合改成全部十六进制组合
1 parent 466d596 commit 2cd49da

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+165
-147
lines changed

internal/teaagent/agents/process.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package teaagents
33
import (
44
"bytes"
55
"github.com/TeaWeb/build/internal/teaconfigs/shared"
6-
"github.com/iwind/TeaGo/utils/string"
6+
"github.com/iwind/TeaGo/rands"
77
"io"
88
"os"
99
"os/exec"
@@ -25,7 +25,7 @@ type Process struct {
2525
// 获取新进程
2626
func NewProcess() *Process {
2727
return &Process{
28-
UniqueId: stringutil.Rand(16),
28+
UniqueId: rands.HexString(16),
2929
}
3030
}
3131

internal/teaconfigs/access_log_storage_policy.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/TeaWeb/build/internal/teautils"
66
"github.com/iwind/TeaGo/Tea"
77
"github.com/iwind/TeaGo/logs"
8-
stringutil "github.com/iwind/TeaGo/utils/string"
8+
"github.com/iwind/TeaGo/rands"
99
"gopkg.in/yaml.v3"
1010
"io/ioutil"
1111
"os"
@@ -25,7 +25,7 @@ type AccessLogStoragePolicy struct {
2525
// 创建新策略
2626
func NewAccessLogStoragePolicy() *AccessLogStoragePolicy {
2727
return &AccessLogStoragePolicy{
28-
Id: stringutil.Rand(16),
28+
Id: rands.HexString(16),
2929
On: true,
3030
}
3131
}

internal/teaconfigs/agents/action_script.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/iwind/TeaGo/files"
99
"github.com/iwind/TeaGo/logs"
1010
"github.com/iwind/TeaGo/maps"
11-
"github.com/iwind/TeaGo/utils/string"
11+
"github.com/iwind/TeaGo/rands"
1212
"os/exec"
1313
"runtime"
1414
"strings"
@@ -83,7 +83,7 @@ func (this *ScriptAction) Run(params map[string]string) (result string, err erro
8383

8484
// 脚本
8585
if this.ScriptType == "code" {
86-
path, err := this.Generate(stringutil.Rand(16))
86+
path, err := this.Generate(rands.HexString(16))
8787
if err != nil {
8888
return "", err
8989
}

internal/teaconfigs/agents/agent.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/iwind/TeaGo/lists"
1212
"github.com/iwind/TeaGo/logs"
1313
"github.com/iwind/TeaGo/maps"
14-
"github.com/iwind/TeaGo/utils/string"
14+
"github.com/iwind/TeaGo/rands"
1515
"gopkg.in/yaml.v3"
1616
)
1717

@@ -41,7 +41,7 @@ type AgentConfig struct {
4141
func NewAgentConfig() *AgentConfig {
4242
return &AgentConfig{
4343
On: true,
44-
Id: stringutil.Rand(16),
44+
Id: rands.HexString(16),
4545
CheckDisconnections: true,
4646
}
4747
}
@@ -55,7 +55,7 @@ func LocalAgentConfig() *AgentConfig {
5555
On: true,
5656
Id: "local",
5757
Name: "本地",
58-
Key: stringutil.Rand(32),
58+
Key: rands.HexString(16),
5959
AllowAll: false,
6060
Allow: []string{"127.0.0.1"},
6161
Host: "127.0.0.1",

internal/teaconfigs/agents/app.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"github.com/TeaWeb/build/internal/teaconfigs/notices"
55
"github.com/TeaWeb/build/internal/teautils"
66
"github.com/iwind/TeaGo/maps"
7-
"github.com/iwind/TeaGo/utils/string"
7+
"github.com/iwind/TeaGo/rands"
88
)
99

1010
// App定义
@@ -24,7 +24,7 @@ type AppConfig struct {
2424
// 获取新对象
2525
func NewAppConfig() *AppConfig {
2626
return &AppConfig{
27-
Id: stringutil.Rand(16),
27+
Id: rands.HexString(16),
2828
On: true,
2929
NoticeSetting: map[notices.NoticeLevel][]*notices.NoticeReceiver{},
3030
}

internal/teaconfigs/agents/group.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/TeaWeb/build/internal/teautils"
77
"github.com/iwind/TeaGo/Tea"
88
"github.com/iwind/TeaGo/maps"
9-
"github.com/iwind/TeaGo/utils/string"
9+
"github.com/iwind/TeaGo/rands"
1010
timeutil "github.com/iwind/TeaGo/utils/time"
1111
"gopkg.in/yaml.v3"
1212
"io/ioutil"
@@ -33,7 +33,7 @@ type Group struct {
3333
// 获取新分组
3434
func NewGroup(name string) *Group {
3535
return &Group{
36-
Id: stringutil.Rand(16),
36+
Id: rands.HexString(16),
3737
On: true,
3838
Name: name,
3939
}
@@ -146,7 +146,7 @@ func (this *Group) WriteToFile(path string) error {
146146

147147
// 生成密钥
148148
func (this *Group) GenerateKey() string {
149-
return stringutil.Rand(32)
149+
return rands.HexString(32)
150150
}
151151

152152
// 匹配关键词

internal/teaconfigs/agents/group_key.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package agents
22

33
import (
4-
stringutil "github.com/iwind/TeaGo/utils/string"
4+
"github.com/iwind/TeaGo/rands"
55
timeutil "github.com/iwind/TeaGo/utils/time"
66
)
77

@@ -20,7 +20,7 @@ type GroupKey struct {
2020
// 创建新Key
2121
func NewGroupKey() *GroupKey {
2222
return &GroupKey{
23-
Id: stringutil.Rand(16),
23+
Id: rands.HexString(16),
2424
On: true,
2525
}
2626
}

internal/teaconfigs/agents/item.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/TeaWeb/build/internal/teaconfigs/widgets"
77
"github.com/TeaWeb/build/internal/teautils"
88
"github.com/iwind/TeaGo/lists"
9-
"github.com/iwind/TeaGo/utils/string"
9+
"github.com/iwind/TeaGo/rands"
1010
"time"
1111
)
1212

@@ -30,7 +30,7 @@ type Item struct {
3030
func NewItem() *Item {
3131
return &Item{
3232
On: true,
33-
Id: stringutil.Rand(16),
33+
Id: rands.HexString(16),
3434
Thresholds: []*Threshold{},
3535
}
3636
}

internal/teaconfigs/agents/source_script.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"github.com/iwind/TeaGo/files"
1010
"github.com/iwind/TeaGo/lists"
1111
"github.com/iwind/TeaGo/logs"
12+
"github.com/iwind/TeaGo/rands"
1213
"github.com/iwind/TeaGo/utils/string"
1314
"os/exec"
1415
"runtime"
@@ -101,7 +102,7 @@ func (this *ScriptSource) Execute(params map[string]string) (value interface{},
101102

102103
// 脚本
103104
if this.ScriptType == "code" {
104-
path, err := this.Generate(stringutil.Rand(16) + stringutil.Md5(this.Code()))
105+
path, err := this.Generate(rands.HexString(16) + stringutil.Md5(this.Code()))
105106
if err != nil {
106107
return nil, err
107108
}

internal/teaconfigs/agents/task.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/TeaWeb/build/internal/teautils"
66
"github.com/iwind/TeaGo/Tea"
77
"github.com/iwind/TeaGo/files"
8-
"github.com/iwind/TeaGo/utils/string"
8+
"github.com/iwind/TeaGo/rands"
99
"runtime"
1010
"strings"
1111
"time"
@@ -30,7 +30,7 @@ type TaskConfig struct {
3030
func NewTaskConfig() *TaskConfig {
3131
return &TaskConfig{
3232
On: true,
33-
Id: stringutil.Rand(16),
33+
Id: rands.HexString(16),
3434
}
3535
}
3636

0 commit comments

Comments
 (0)