cmd

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2022 License: Apache-2.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Main = &gcmd.Command{
		Name:        "main",
		Brief:       "start http server",
		Description: "this is the command entry for starting your process",
	}

	Http = &gcmd.Command{
		Name:        "http",
		Brief:       "start http server",
		Description: "this is the command entry for starting your http server",
		Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
			fmt.Println("start http server")
			s := g.Server()
			s.SetIndexFolder(true)
			s.SetServerRoot("./resource/public/html")
			s.Group("/", func(group *ghttp.RouterGroup) {
				router.BindController(group)
				group.GET("/swagger", func(r *ghttp.Request) {
					r.Response.Write(swaggerUIPageContent)
				})
			})
			enhanceOpenAPIDoc(s)
			s.Run()
			return nil
		},
	}
	Mqtt = &gcmd.Command{
		Name:        "mqtt",
		Brief:       "start mqtt server",
		Description: "this is the command entry for starting your mqtt server",
		Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
			fmt.Println("start mqtt server")
			SetConfigPath("./manifest/config/default_config.yml")
			NewSimpleCmd()
			return
		},
	}

	Plugin = &gcmd.Command{
		Name:        "plugin",
		Brief:       "start plugin server",
		Description: "this is the command entry for starting your plugin server",
		Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
			plu := pl.NewServer("unix", "E:\\src\\iotfast\\plugin\\examples\\client")
			plu.Start()
			return
		},
	}

	All = &gcmd.Command{
		Name:        "all",
		Brief:       "start all server",
		Description: "this is the command entry for starting all server",
		Func: func(ctx context.Context, parser *gcmd.Parser) (err error) {
			fmt.Println("start all server")
			go Http.Func(ctx, parser)
			go Plugin.Func(ctx, parser)
			Mqtt.Func(ctx, parser)

			return
		},
	}
)
View Source
var (
	ConfigFile string
)

Functions

func GetListeners

func GetListeners(c config.Config) (tcpListeners []net.Listener, websockets []*server.WsServer, err error)

func NewSimpleCmd

func NewSimpleCmd() (err error)

func NewStartCmd

func NewStartCmd() *cobra.Command

NewStartCmd creates a *cobra.Command object for start command.

func SetConfigPath

func SetConfigPath(path string)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL