29 lines
447 B
Go
29 lines
447 B
Go
package ws
|
|
|
|
import (
|
|
"common/utils"
|
|
"robot/config"
|
|
"strconv"
|
|
"time"
|
|
)
|
|
|
|
type Manager struct {
|
|
addr string
|
|
}
|
|
|
|
func NewManager(addr string) *Manager {
|
|
c := &Manager{
|
|
addr: addr,
|
|
}
|
|
return c
|
|
}
|
|
|
|
func (c *Manager) Start() {
|
|
cfg := config.Get().Client
|
|
for i := int32(0); i < cfg.Count; i++ {
|
|
client := NewClient(c.addr, strconv.Itoa(utils.RandInt(int(cfg.UID[0]), int(cfg.UID[1]))))
|
|
client.Start()
|
|
time.Sleep(time.Millisecond * 10)
|
|
}
|
|
}
|