12.6.25
This commit is contained in:
3
docs/code_server.md
Normal file
3
docs/code_server.md
Normal file
@@ -0,0 +1,3 @@
|
||||
to run: /opt/homebrew/opt/code-server/bin/code-server
|
||||
|
||||
to get password or change port: cat /Users/samrussell/.config/code-server/config.yaml
|
||||
10
docs/gitea.md
Normal file
10
docs/gitea.md
Normal file
@@ -0,0 +1,10 @@
|
||||
/opt/homebrew/bin/custom/conf/app.ini
|
||||
this file stores the path of the repos
|
||||
|
||||
Command to replace remote origin:
|
||||
git remote set-url origin https://admin.sun.museum/sam/Hyperia.git
|
||||
|
||||
'gitea web' to start
|
||||
|
||||
username: sam
|
||||
password: same as RTTL
|
||||
2
docs/ssh.md
Normal file
2
docs/ssh.md
Normal file
@@ -0,0 +1,2 @@
|
||||
# See Logs
|
||||
sudo log stream --predicate 'process == "sshd"' --info
|
||||
100
main.go
100
main.go
@@ -85,48 +85,58 @@ func rootHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
}
|
||||
|
||||
func serveProxy(w http.ResponseWriter, r *http.Request, port int) {
|
||||
target, _ := url.Parse(fmt.Sprintf("http://localhost:%d", port))
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
proxy.ServeHTTP(w, r)
|
||||
}
|
||||
|
||||
func outsideHandler(w http.ResponseWriter, r *http.Request) {
|
||||
if r.Host == "america.sun.museum" {
|
||||
target, _ := url.Parse("http://localhost:8000")
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
r.Host = target.Host
|
||||
proxy.ServeHTTP(w, r)
|
||||
return
|
||||
} else
|
||||
if(r.Host == "thefiveprinciples.org") {
|
||||
target, _ := url.Parse("http://localhost:3001")
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
r.Host = target.Host
|
||||
proxy.ServeHTTP(w, r)
|
||||
return
|
||||
} else
|
||||
if(r.Host == "americanforum.net") {
|
||||
target, _ := url.Parse("http://localhost:3002")
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
r.Host = target.Host
|
||||
proxy.ServeHTTP(w, r)
|
||||
return
|
||||
} else
|
||||
if(r.Host == "hyperia.so") {
|
||||
target, _ := url.Parse("http://localhost:3003")
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
r.Host = target.Host
|
||||
proxy.ServeHTTP(w, r)
|
||||
return
|
||||
} else
|
||||
if(r.Host == "aryan.so") {
|
||||
target, _ := url.Parse("http://localhost:3004")
|
||||
proxy := httputil.NewSingleHostReverseProxy(target)
|
||||
r.Host = target.Host
|
||||
proxy.ServeHTTP(w, r)
|
||||
return
|
||||
} else
|
||||
if r.Host == "admin.sun.museum" {
|
||||
src.BetaSignupHandler(w, r)
|
||||
return
|
||||
host := r.Host
|
||||
if strings.HasSuffix(host, ".parchment.page") {
|
||||
host = "parchment.page"
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "Hello, World! You're from outside.")
|
||||
switch host {
|
||||
case "america.sun.museum":
|
||||
serveProxy(w, r, 8000)
|
||||
|
||||
case "thefiveprinciples.org":
|
||||
serveProxy(w, r, 3001)
|
||||
|
||||
case "americanforum.net":
|
||||
serveProxy(w, r, 3002)
|
||||
|
||||
case "hyperia.so":
|
||||
serveProxy(w, r, 3003)
|
||||
|
||||
case "pma.aryan.so", "aryan.so", "apply.aryan.so":
|
||||
serveProxy(w, r, 3004)
|
||||
|
||||
case "parchment.page":
|
||||
serveProxy(w, r, 3005)
|
||||
|
||||
case "government.forum":
|
||||
serveProxy(w, r, 3006)
|
||||
|
||||
case "noahkurtis.com":
|
||||
serveProxy(w, r, 3007)
|
||||
|
||||
case "comalyr.com":
|
||||
serveProxy(w, r, 3008)
|
||||
|
||||
case "blockcatcher.sun.museum":
|
||||
serveProxy(w, r, 3009)
|
||||
|
||||
case "git.sun.museum":
|
||||
serveProxy(w, r, 4000)
|
||||
|
||||
case "admin.sun.museum":
|
||||
serveProxy(w, r, 8080)
|
||||
|
||||
default:
|
||||
fmt.Fprintf(w, "Hello, World! You're from outside.")
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
@@ -150,17 +160,21 @@ func main() {
|
||||
}
|
||||
|
||||
// Example domains
|
||||
loadCert("parchment.page")
|
||||
loadCert("hyperia.so")
|
||||
loadCert("parchment.page-0001") // Separate to allow wildcards
|
||||
loadCert("hyperia.so-0001")
|
||||
|
||||
// Configure TLS with SNI
|
||||
tlsConfig := &tls.Config{
|
||||
GetCertificate: func(hello *tls.ClientHelloInfo) (*tls.Certificate, error) {
|
||||
if cert, ok := certs[hello.ServerName]; ok {
|
||||
serverName := strings.ToLower(hello.ServerName)
|
||||
if cert, ok := certs[serverName]; ok {
|
||||
return cert, nil
|
||||
}
|
||||
if strings.HasSuffix(serverName, ".parchment.page") {
|
||||
return certs["parchment.page-0001"], nil
|
||||
}
|
||||
// fallback: return any default cert
|
||||
return certs["hyperia.so"], nil
|
||||
return certs["hyperia.so-0001"], nil
|
||||
},
|
||||
MinVersion: tls.VersionTLS12,
|
||||
}
|
||||
|
||||
@@ -21,12 +21,15 @@ sudo certbot certonly \
|
||||
--standalone \
|
||||
-d hyperia.so \
|
||||
-d aryan.so \
|
||||
-d comalyr.com \
|
||||
-d admin.sun.museum \
|
||||
-d america.sun.museum \
|
||||
-d noahkurtis.com \
|
||||
-d git.sun.museum \
|
||||
-d blockcatcher.sun.museum \
|
||||
-d americanforum.net \
|
||||
-d thefiveprinciples.org \
|
||||
-d government.forum
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user