Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jannik Hoelling
alpaca-libraries
Commits
06f5bd18
Commit
06f5bd18
authored
Nov 11, 2021
by
Jannik Hoelling
Browse files
go implement strict SNI server
parent
cff0e16a
Changes
1
Hide whitespace changes
Inline
Side-by-side
golang/server/server.go
View file @
06f5bd18
...
...
@@ -53,7 +53,6 @@ func main() {
// if no hostname is sent continue
conf
.
VerifyConnection
=
func
(
cs
tls
.
ConnectionState
)
error
{
if
cs
.
NegotiatedProtocol
==
""
{
return
nil
return
errors
.
New
(
"INVALID ALPN"
)
}
else
if
cs
.
ServerName
!=
servername
&&
len
(
cs
.
ServerName
)
>
0
{
return
errors
.
New
(
"INVALID SNI: "
+
cs
.
ServerName
)
...
...
@@ -63,6 +62,14 @@ func main() {
return
nil
}
}
}
else
{
conf
.
VerifyConnection
=
func
(
cs
tls
.
ConnectionState
)
error
{
if
cs
.
ServerName
!=
servername
&&
len
(
cs
.
ServerName
)
>
0
{
return
errors
.
New
(
"INVALID SNI: "
+
cs
.
ServerName
)
}
else
{
return
nil
}
}
}
// Listen for connections
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment