improved TLS for server.

This commit is contained in:
idk
2018-08-24 00:32:58 -04:00
parent 9fdd2d51ce
commit bf840247ba
2 changed files with 10 additions and 25 deletions

View File

@ -183,12 +183,12 @@ that happen eventually.
TLS configuration is experimental. It might not be possible. But maybe.
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAlt/hhQACgkQ11wDs5te
FOGxWAf+M0NRNgg32nx/NvnEC9uovFb9HCmn2RdZkhJD0FU0iXpiipnf1WEriqvp
ZQcgiC6oXrVYvFSvM0fd0QTsx9f/UfVkG2/QLWFOh9GnWDmZi8AGxfsrAzBkT1Q3
0Hzi5vGLlr0CxVMrEvHoSvK+JA8t78spy4IVAMD7wqjJsYXhI/BwrKDi7fG7P6Kb
7Hv5O2YVpuToj9Rsq3KlgrSoRef4weF/hLGrGKE4BkIv+sqwEPtWp4lGBx8Xm9sF
L5xhD65B4DJJwhvY9gshT1CrOmr+u6ONQ92CVfLLEftHKUW/+xSQg/ioBOpalycI
apR5QuT9vdImG7vgDaf2HAWjSbDAVA==
=m59z
iQEzBAEBCAAdFiEEcNIGBzi++AUjrK/311wDs5teFOEFAlt/inYACgkQ11wDs5te
FOG3mAf+PT3PHWHzVKME2hQ73RlcyYGmuh5/GUFQf6IPhB5cwFvvOpT10lNh5ndd
BQce3NxaaiVvgjoRmerMHlq6+w2L+l41sYmdO7MxGCR3CJwE3xEASFOk2maPcW0p
YO8tuaZ4xbf10QYDNw70tsIn6oSh3XLi8n/vGUDqB3p6fupHjV/fowUp88FMxhit
soHlE51XvuzzqiX6np4hnA2fxGRu/YEds5AK66p+SgGJI3k0vj31jUvWcCthsLP/
VHJu7ti938dylS+UAE2EYec7BkGTEcj/oVeghW8/HGB3YnHASp0Q24MGZ2hi2/3y
vhNOR45FI4uPgl4mNFwccWffQV2N4Q==
=5el3
-----END PGP SIGNATURE-----

View File

@ -5,7 +5,6 @@ import (
"flag"
"log"
"net/http"
"strconv"
)
import (
@ -85,23 +84,10 @@ func main() {
config.ReduceIdle = config.GetReduceOnIdle(*reduceIdle, true)
config.ReduceIdleTime = config.GetReduceIdleTime(*reduceIdleTime, 600000)
config.ReduceIdleQuantity = config.GetReduceIdleQuantity(*reduceIdleQuantity, 2)
config.CloseIdleTime = config.GetCloseIdleTime(*reduceIdleTime, 600000)
config.AccessListType = config.GetAccessListType(*accessListType, "none")
config.Type = config.GetType(false, false, "server")
if *useTLS {
if i, e := strconv.Atoi(*port); e == nil {
j := i //+ 1
if tlsport = strconv.Itoa(j); e == nil {
config.TargetForPort443 = config.GetPort443(*host+":"+tlsport, *host+":"+*port)
config.TargetPort = config.GetPort(tlsport, *port)
} else {
log.Fatal(e.Error())
}
} else {
log.Fatal(e.Error())
}
}
if forwarder, err = i2ptunconf.NewSAMForwarderFromConf(config); err != nil {
log.Fatal(err.Error())
}
@ -122,12 +108,11 @@ func main() {
),
)
} else {
http.Handle("/", http.FileServer(http.Dir(*directory)))
log.Printf("Serving %s on HTTP port: %s\n\t and on %s", *directory, *port, forwarder.Base32())
log.Fatal(
http.ListenAndServe(
*host+":"+*port,
nil,
http.FileServer(http.Dir(*directory)),
),
)
}