github.com/geph-official/geph2@v0.22.6-0.20210211030601-f527cb59b0df/cmd/geph-bridge/wfloop.go (about)

     1  package main
     2  
     3  import (
     4  	"net/http"
     5  
     6  	"github.com/geph-official/geph2/libs/warpfront"
     7  )
     8  
     9  func wfLoop() {
    10  	wfs := warpfront.NewServer()
    11  	server := &http.Server{
    12  		Addr:    wfAddr,
    13  		Handler: wfs,
    14  	}
    15  	go func() {
    16  		panic(server.ListenAndServe())
    17  	}()
    18  	for {
    19  		client, err := wfs.Accept()
    20  		if err != nil {
    21  			panic(err)
    22  		}
    23  		go handle(client)
    24  	}
    25  }