go_dreamfactory/cmd/robot/options.go
2022-06-06 14:40:16 +08:00

37 lines
643 B
Go

package robot
type Options struct {
WsUrl string //客户端访问网关的ws接口地址
RegUrl string //账号注册接口地址
Account string //玩家账号
Create bool
}
func DefaultOpts() *Options {
return &Options{
WsUrl: "ws://localhost:7891/gateway",
RegUrl: "http://localhost:8000/register",
Create: false,
}
}
type Option func(*Options)
func WithWsUrl(addr string) Option {
return func(o *Options) {
o.WsUrl = addr
}
}
func WithAccount(account string) Option {
return func(o *Options) {
o.Account = account
}
}
func WithCreate(create bool) Option {
return func(o *Options) {
o.Create = create
}
}