diff --git a/README.md b/README.md index 0bcebbf..12f6890 100644 --- a/README.md +++ b/README.md @@ -4,18 +4,6 @@ ### How to generate cert file and key file -``` -mkdir certs -rm certs/* - -# for tls server -openssl req -new -nodes -x509 -out certs/server.pem -keyout certs/server.key -days 36500 - -# for tls client -openssl req -new -nodes -x509 -out certs/client.pem -keyout certs/client.key -days 36500 -``` - - ``` mkdir certs rm certs/* @@ -34,7 +22,6 @@ openssl x509 -req -in certs/server.csr -out certs/server.pem -signkey certs/serv openssl genrsa -out certs/client.key 2048 openssl req -new -key certs/client.key -out certs/client.csr openssl x509 -req -in certs/client.csr -out certs/client.pem -signkey certs/client.key -CA certs/ca.pem -CAkey certs/ca.key -CAcreateserial -days 36500 - ``` ### Client diff --git a/cmd/tls-proxy-client/client.go b/cmd/tls-proxy-client/client.go index 648c034..79a086c 100644 --- a/cmd/tls-proxy-client/client.go +++ b/cmd/tls-proxy-client/client.go @@ -34,7 +34,12 @@ func clientHandler(conn *net.TCPConn, config *tls_proxy_go.ClientConfig) { return } - tlsConfig := tls.Config{Certificates: []tls.Certificate{cert}, InsecureSkipVerify: true, RootCAs: certPool} + tlsConfig := tls.Config{ + Certificates: []tls.Certificate{cert}, + InsecureSkipVerify: true, + RootCAs: certPool, + } + clientConn, err := tls.Dial("tcp", fmt.Sprintf("%s:%d", config.ServerHost, config.ServerPort), &tlsConfig)