[PD1] FIXED TLS Handshake
This commit is contained in:
parent
1cb81d2279
commit
4cf7880e57
5 changed files with 77 additions and 22 deletions
|
@ -8,7 +8,7 @@ import (
|
|||
)
|
||||
|
||||
type ServerTLSConfigProvider interface {
|
||||
GetTLSConfig() *tls.Config
|
||||
GetServerTLSConfig() *tls.Config
|
||||
}
|
||||
|
||||
type Server[T any] struct {
|
||||
|
@ -18,7 +18,7 @@ type Server[T any] struct {
|
|||
|
||||
func NewServer[T any](serverTLSConfigProvider ServerTLSConfigProvider, port int) Server[T] {
|
||||
|
||||
listener, err := tls.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", port), serverTLSConfigProvider.GetTLSConfig())
|
||||
listener, err := tls.Listen("tcp", fmt.Sprintf("0.0.0.0:%d", port), serverTLSConfigProvider.GetServerTLSConfig())
|
||||
if err != nil {
|
||||
panic("Server could not bind to address")
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ func (s *Server[T]) ListenLoop() {
|
|||
if !ok {
|
||||
panic("Connection is not a TLS connection")
|
||||
}
|
||||
fmt.Println(tlsConn)
|
||||
tlsConn.Handshake()
|
||||
|
||||
state := tlsConn.ConnectionState()
|
||||
if len(state.PeerCertificates) == 0 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue