Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var RootCmd = &cobra.Command{ Use: os.Args[0], Short: "piping-server", Long: "Infinitely transfer between any device over pure HTTP", SilenceUsage: true, RunE: func(cmd *cobra.Command, args []string) error { if showsVersion { fmt.Printf("%s (%s)\n", version.Version, runtime.Version()) return nil } logger := log.New(os.Stderr, "", log.LstdFlags|log.Lmicroseconds) logger.Printf("Piping Server %s (%s)", version.Version, runtime.Version()) pipingServer := piping_server.NewServer(logger) errCh := make(chan error) if enableHttps || enableHttp3 { if keyPath == "" { return errors.New("--key-path should be specified") } if crtPath == "" { return errors.New("--crt-path should be specified") } go func() { logger.Printf("Listening HTTPS on %d...\n", httpsPort) errCh <- http.ListenAndServeTLS(fmt.Sprintf(":%d", httpsPort), crtPath, keyPath, http.HandlerFunc(pipingServer.Handler)) }() if enableHttp3 { go func() { logger.Printf("Listening HTTP/3 on %d...\n", httpsPort) errCh <- http3.ListenAndServeQUIC(fmt.Sprintf(":%d", httpsPort), crtPath, keyPath, http.HandlerFunc(pipingServer.Handler)) }() } } go func() { server := &http.Server{ Addr: fmt.Sprintf(":%d", httpPort), Handler: h2c.NewHandler(http.HandlerFunc(pipingServer.Handler), &http2.Server{}), } logger.Printf("Listening HTTP on %d...\n", httpPort) errCh <- server.ListenAndServe() }() return <-errCh }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.