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

internal/teaconfigs/agents/threshold.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/TeaWeb/build/internal/teautils"
99
"github.com/iwind/TeaGo/lists"
1010
"github.com/iwind/TeaGo/logs"
11+
"github.com/iwind/TeaGo/rands"
1112
"github.com/iwind/TeaGo/types"
1213
"github.com/iwind/TeaGo/utils/string"
1314
"net"
@@ -44,7 +45,7 @@ type Threshold struct {
4445
// 新阈值对象
4546
func NewThreshold() *Threshold {
4647
return &Threshold{
47-
Id: stringutil.Rand(16),
48+
Id: rands.HexString(16),
4849
}
4950
}
5051

internal/teaconfigs/api/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/iwind/TeaGo/files"
77
"github.com/iwind/TeaGo/lists"
88
"github.com/iwind/TeaGo/logs"
9-
"github.com/iwind/TeaGo/utils/string"
9+
"github.com/iwind/TeaGo/rands"
1010
"math/rand"
1111
"regexp"
1212
"time"
@@ -215,7 +215,7 @@ func (this *API) ChangeVersion(oldName string, newName string) {
215215
// 保存到文件
216216
func (this *API) Save() error {
217217
if len(this.Filename) == 0 {
218-
this.Filename = "api." + stringutil.Rand(16) + ".conf"
218+
this.Filename = "api." + rands.HexString(16) + ".conf"
219219
}
220220
writer, err := files.NewWriter(Tea.ConfigFile(this.Filename))
221221
if err != nil {

internal/teaconfigs/api/api_consumer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/iwind/TeaGo/files"
77
"github.com/iwind/TeaGo/lists"
88
"github.com/iwind/TeaGo/logs"
9-
"github.com/iwind/TeaGo/utils/string"
9+
"github.com/iwind/TeaGo/rands"
1010
)
1111

1212
// API consumer
@@ -68,7 +68,7 @@ func (this *APIConsumer) Validate() error {
6868
// 保存
6969
func (this *APIConsumer) Save() error {
7070
if len(this.Filename) == 0 {
71-
this.Filename = "consumer." + stringutil.Rand(16) + ".conf"
71+
this.Filename = "consumer." + rands.HexString(16) + ".conf"
7272
}
7373
writer, err := files.NewWriter(Tea.ConfigFile(this.Filename))
7474
if err != nil {

internal/teaconfigs/api/api_mock.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/iwind/TeaGo/files"
66
"github.com/iwind/TeaGo/logs"
77
"github.com/iwind/TeaGo/maps"
8-
"github.com/iwind/TeaGo/utils/string"
8+
"github.com/iwind/TeaGo/rands"
99
)
1010

1111
// API的mock格式定义
@@ -61,7 +61,7 @@ func NewAPIMockFromFile(filename string) *APIMock {
6161
// 保存
6262
func (this *APIMock) Save() error {
6363
if len(this.Filename) == 0 {
64-
this.Filename = "mock." + stringutil.Rand(16) + ".conf"
64+
this.Filename = "mock." + rands.HexString(16) + ".conf"
6565
}
6666
writer, err := files.NewWriter(Tea.ConfigFile(this.Filename))
6767
if err != nil {

internal/teaconfigs/api/api_script.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package api
33
import (
44
"github.com/iwind/TeaGo/Tea"
55
"github.com/iwind/TeaGo/files"
6-
"github.com/iwind/TeaGo/utils/string"
6+
"github.com/iwind/TeaGo/rands"
77
)
88

99
// 脚本定义
@@ -20,7 +20,7 @@ func NewAPIScript() *APIScript {
2020
// 保存
2121
func (this *APIScript) Save() error {
2222
if len(this.Filename) == 0 {
23-
this.Filename = "script." + stringutil.Rand(16) + ".conf"
23+
this.Filename = "script." + rands.HexString(16) + ".conf"
2424
}
2525
writer, err := files.NewFile(Tea.ConfigFile(this.Filename)).Writer()
2626
if err != nil {

internal/teaconfigs/api/api_test_case.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/iwind/TeaGo/files"
66
"github.com/iwind/TeaGo/logs"
77
"github.com/iwind/TeaGo/maps"
8-
"github.com/iwind/TeaGo/utils/string"
8+
"github.com/iwind/TeaGo/rands"
99
)
1010

1111
// 测试历史
@@ -51,7 +51,7 @@ func NewAPITestCaseFromFile(filename string) *APITestCase {
5151
// 保存到文件
5252
func (this *APITestCase) Save() error {
5353
if len(this.Filename) == 0 {
54-
this.Filename = "test.case." + stringutil.Rand(16) + ".conf"
54+
this.Filename = "test.case." + rands.HexString(16) + ".conf"
5555
}
5656
writer, err := files.NewWriter(Tea.ConfigFile(this.Filename))
5757
if err != nil {

internal/teaconfigs/api/api_test_plan.go

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

@@ -56,7 +56,7 @@ func NewAPITestPlanFromFile(filename string) *APITestPlan {
5656
// 保存当前测试计划
5757
func (this *APITestPlan) Save() error {
5858
if len(this.Filename) == 0 {
59-
this.Filename = "plan." + stringutil.Rand(16) + ".conf"
59+
this.Filename = "plan." + rands.HexString(16)+ ".conf"
6060
}
6161
file := files.NewFile(Tea.ConfigFile(this.Filename))
6262
writer, err := file.Writer()

internal/teaconfigs/api/api_test_plan_report.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"github.com/iwind/TeaGo/files"
66
"github.com/iwind/TeaGo/logs"
77
"github.com/iwind/TeaGo/maps"
8-
"github.com/iwind/TeaGo/utils/string"
8+
"github.com/iwind/TeaGo/rands"
99
"github.com/iwind/TeaGo/utils/time"
1010
"sync"
1111
"time"
@@ -51,7 +51,7 @@ func NewAPITestPlanReportFromFile(filename string) *APITestPlanReport {
5151

5252
// 初始化文件信息
5353
func (this *APITestPlanReport) InitFile() {
54-
this.Filename = "report." + stringutil.Rand(16) + ".conf"
54+
this.Filename = "report." + rands.HexString(16)+ ".conf"
5555
}
5656

5757
// 计算总结果数

internal/teaconfigs/backend.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import (
88
"github.com/TeaWeb/build/internal/teautils"
99
"github.com/iwind/TeaGo/lists"
1010
"github.com/iwind/TeaGo/logs"
11+
"github.com/iwind/TeaGo/rands"
1112
"github.com/iwind/TeaGo/timers"
12-
stringutil "github.com/iwind/TeaGo/utils/string"
1313
"net"
1414
"net/http"
1515
"strings"
@@ -91,7 +91,7 @@ type BackendConfig struct {
9191
func NewBackendConfig() *BackendConfig {
9292
return &BackendConfig{
9393
On: true,
94-
Id: stringutil.Rand(16),
94+
Id: rands.HexString(16),
9595
TeaVersion: teaconst.TeaVersion,
9696
}
9797
}

internal/teaconfigs/fastcgi.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/teaconfigs/shared"
66
"github.com/TeaWeb/build/internal/teaconst"
77
"github.com/iwind/TeaGo/maps"
8-
"github.com/iwind/TeaGo/utils/string"
8+
"github.com/iwind/TeaGo/rands"
99
"net/http"
1010
"path/filepath"
1111
"regexp"
@@ -43,7 +43,7 @@ type FastcgiConfig struct {
4343
func NewFastcgiConfig() *FastcgiConfig {
4444
return &FastcgiConfig{
4545
On: true,
46-
Id: stringutil.Rand(16),
46+
Id: rands.HexString(16),
4747
}
4848
}
4949

0 commit comments

Comments
 (0)