mirror of
https://github.com/fatedier/frp.git
synced 2025-07-27 07:35:07 +00:00
vhost: use new readClientHello function (#2504)
This commit is contained in:
@@ -11,7 +11,7 @@ import (
|
||||
type Server struct {
|
||||
bindAddr string
|
||||
bindPort int
|
||||
hanlder http.Handler
|
||||
handler http.Handler
|
||||
|
||||
l net.Listener
|
||||
tlsConfig *tls.Config
|
||||
@@ -54,14 +54,14 @@ func WithTlsConfig(tlsConfig *tls.Config) Option {
|
||||
|
||||
func WithHandler(h http.Handler) Option {
|
||||
return func(s *Server) *Server {
|
||||
s.hanlder = h
|
||||
s.handler = h
|
||||
return s
|
||||
}
|
||||
}
|
||||
|
||||
func WithResponse(resp []byte) Option {
|
||||
return func(s *Server) *Server {
|
||||
s.hanlder = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
s.handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
w.Write(resp)
|
||||
})
|
||||
return s
|
||||
@@ -76,7 +76,7 @@ func (s *Server) Run() error {
|
||||
addr := net.JoinHostPort(s.bindAddr, strconv.Itoa(s.bindPort))
|
||||
hs := &http.Server{
|
||||
Addr: addr,
|
||||
Handler: s.hanlder,
|
||||
Handler: s.handler,
|
||||
TLSConfig: s.tlsConfig,
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user