1
0

feat: 合并代码

This commit is contained in:
TsMask
2024-01-12 15:54:24 +08:00
parent 3cec6077d3
commit 94392e13fd
52 changed files with 1962 additions and 191 deletions

View File

@@ -36,12 +36,11 @@ func NewMMLClient(ip string) (*MMLClient, error) {
fmt.Fprintln(conn, passwordMML)
// 发送后等待
sleepTime := conf.Get("mml.sleep").(int)
awaitTime := time.Duration(sleepTime) * time.Millisecond
awaitTime := time.Duration(300) * time.Millisecond
time.Sleep(awaitTime)
// 读取内容
buf := make([]byte, 1024*8)
buf := make([]byte, 1024*1024*1)
n, err := conn.Read(buf)
if err != nil {
return nil, err
@@ -70,7 +69,7 @@ func (c *MMLClient) Send(msg string) error {
// 封装Receive函数用于从TCP连接中接收数据
func (c *MMLClient) Receive() (string, error) {
buf := make([]byte, 1024*8)
buf := make([]byte, 1024*1024*1)
n, err := c.reader.Read(buf)
if err != nil {
if err == io.EOF {
@@ -78,7 +77,7 @@ func (c *MMLClient) Receive() (string, error) {
}
return "", err
}
c.size += n
return string(buf[0:n]), nil
}