修订代码;将addr的赋值从各个proxy自己的方法中提出来

This commit is contained in:
hahahrfool
2022-03-23 18:54:38 +08:00
parent b2c6abe330
commit 8c6ed6377d
9 changed files with 46 additions and 25 deletions

View File

@@ -8,18 +8,16 @@ import (
)
type Server struct {
addr string
tlsConfig *tls.Config
}
func NewServer(hostAndPort, host, certFile, keyFile string, isInsecure bool) (*Server, error) {
func NewServer(host, certFile, keyFile string, isInsecure bool) (*Server, error) {
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
return nil, err
}
s := &Server{
addr: hostAndPort,
tlsConfig: &tls.Config{
InsecureSkipVerify: isInsecure,
ServerName: host,