STUFF
This commit is contained in:
@@ -2,4 +2,7 @@ module github.com/CalebQ42/darkstorm-server
|
|||||||
|
|
||||||
go 1.17
|
go 1.17
|
||||||
|
|
||||||
require github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39
|
require (
|
||||||
|
github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39
|
||||||
|
github.com/cssivision/reverseproxy v0.0.1
|
||||||
|
)
|
||||||
|
|||||||
@@ -1,2 +1,4 @@
|
|||||||
github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39 h1:wAEqazqaAqb7wwijTl14KruBl7cvYytD3SkhXT9v5zs=
|
github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39 h1:wAEqazqaAqb7wwijTl14KruBl7cvYytD3SkhXT9v5zs=
|
||||||
github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39/go.mod h1:zK6NTEHRcxPf9N4gcm0WXvE8RpsJfg/a8hMSW6dAQ0c=
|
github.com/1lann/udp-forward v0.0.0-20191015034046-6b774a53ea39/go.mod h1:zK6NTEHRcxPf9N4gcm0WXvE8RpsJfg/a8hMSW6dAQ0c=
|
||||||
|
github.com/cssivision/reverseproxy v0.0.1 h1:IvhNE3XITZOWFhON2faKbrDeGpqa+yfessLQKSSt15U=
|
||||||
|
github.com/cssivision/reverseproxy v0.0.1/go.mod h1:+QTeWrlVNQDAiB3pnaecTCk5rh1sS3cJltUl/+L2APg=
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"crypto/tls"
|
||||||
"flag"
|
"flag"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
@@ -25,10 +26,34 @@ func webserver() {
|
|||||||
quitChan <- "web arg"
|
quitChan <- "web arg"
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||||
http.Handle("/SWAssistant/", swaHandler{})
|
http.Handle("/SWAssistant/", swaHandler{})
|
||||||
http.Handle("/", http.FileServer(http.Dir(path)))
|
http.Handle("/", http.FileServer(http.Dir(path)))
|
||||||
http.Handle("rpg.darkstorm.tech/", sup{})
|
http.Handle("rpg.darkstorm.tech/", sup{})
|
||||||
err := http.ListenAndServeTLS(":443", keyPath+"/cert.pem", keyPath+"/key.pem", nil)
|
http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
|
||||||
|
tlsConf := &tls.Config{
|
||||||
|
InsecureSkipVerify: true,
|
||||||
|
}
|
||||||
|
cert, err := tls.LoadX509KeyPair(keyPath+"/cert.pem", keyPath+"/key.pem")
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Error while serving website:", err)
|
||||||
|
quitChan <- "web err"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tlsConf.Certificates = append(tlsConf.Certificates, cert)
|
||||||
|
cert, err = tls.LoadX509KeyPair(keyPath+"/foundrycert.pem", keyPath+"/foundrykey.pem")
|
||||||
|
if err != nil {
|
||||||
|
log.Println("Error while serving website:", err)
|
||||||
|
quitChan <- "web err"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
tlsConf.Certificates = append(tlsConf.Certificates, cert)
|
||||||
|
serve := http.Server{
|
||||||
|
Addr: ":443",
|
||||||
|
TLSConfig: tlsConf,
|
||||||
|
}
|
||||||
|
err = serve.ListenAndServeTLS("", "")
|
||||||
|
// err := http.ListenAndServeTLS(":443", keyPath+"/cert.pem", keyPath+"/key.pem", nil)
|
||||||
log.Println("Error while serving website:", err)
|
log.Println("Error while serving website:", err)
|
||||||
quitChan <- "web err"
|
quitChan <- "web err"
|
||||||
}
|
}
|
||||||
@@ -36,8 +61,7 @@ func webserver() {
|
|||||||
type sup struct{}
|
type sup struct{}
|
||||||
|
|
||||||
func (s sup) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
|
func (s sup) ServeHTTP(writer http.ResponseWriter, req *http.Request) {
|
||||||
fmt.Println(req.URL)
|
url, err := url.Parse("https://localhost:30000")
|
||||||
url, err := url.Parse("http://localhost:30000")
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
http.FileServer(http.Dir(flag.Arg(0))).ServeHTTP(writer, req)
|
http.FileServer(http.Dir(flag.Arg(0))).ServeHTTP(writer, req)
|
||||||
|
|||||||
Reference in New Issue
Block a user