Run go fmt

This commit is contained in:
Anders Pitman 2020-10-02 17:09:14 -06:00
parent be91ff62ef
commit c285f0990f
7 changed files with 284 additions and 292 deletions

6
api.go
View File

@ -3,9 +3,9 @@ package main
import (
//"fmt"
//"strings"
"net/http"
"io"
"encoding/json"
"io"
"net/http"
)
type Api struct {
@ -23,7 +23,6 @@ type CreateTunnelResponse struct {
TunnelPrivateKey string `json:"tunnel_private_key"`
}
func NewApi(config *BoringProxyConfig, auth *Auth, tunMan *TunnelManager) *Api {
api := &Api{config, auth, tunMan, nil}
@ -37,7 +36,6 @@ func NewApi(config *BoringProxyConfig, auth *Auth, tunMan *TunnelManager) *Api {
return api
}
func (a *Api) ServeHTTP(w http.ResponseWriter, r *http.Request) {
a.mux.ServeHTTP(w, r)
}

View File

@ -4,16 +4,16 @@ import (
"crypto/tls"
"encoding/json"
"fmt"
"github.com/GeertJohan/go.rice"
"github.com/caddyserver/certmagic"
"html/template"
"io"
"io/ioutil"
"log"
"net"
"net/http"
"html/template"
"strconv"
"sync"
"github.com/caddyserver/certmagic"
"github.com/GeertJohan/go.rice"
)
type BoringProxyConfig struct {
@ -135,7 +135,6 @@ func (p *BoringProxy) handleAdminRequest(w http.ResponseWriter, r *http.Request)
return
}
indexTemplate, err := box.String("index.tmpl")
if err != nil {
w.WriteHeader(500)
@ -151,7 +150,6 @@ func (p *BoringProxy) handleAdminRequest(w http.ResponseWriter, r *http.Request)
return
}
tmpl.Execute(w, p.tunMan.tunnels)
//io.WriteString(w, indexTemplate)
@ -258,7 +256,6 @@ func (p *BoringProxy) handleLogin(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/", 307)
case "POST":
r.ParseForm()

View File

@ -1,13 +1,12 @@
package main
import (
"log"
"fmt"
"golang.org/x/crypto/ssh"
"io/ioutil"
"log"
)
type BoringProxyClient struct {
}

View File

@ -2,19 +2,17 @@ package main
import (
"fmt"
"golang.org/x/crypto/ssh"
"io/ioutil"
"log"
"net"
"io/ioutil"
"golang.org/x/crypto/ssh"
)
type SshServer struct {
config *ssh.ServerConfig
listener net.Listener
}
func NewSshServer() *SshServer {
config := &ssh.ServerConfig{}

View File

@ -1,19 +1,19 @@
package main
import (
"fmt"
"strings"
"crypto/rand"
"crypto/rsa"
"crypto/x509"
"encoding/json"
"encoding/pem"
"errors"
"fmt"
"github.com/caddyserver/certmagic"
"golang.org/x/crypto/ssh"
"io/ioutil"
"log"
"strings"
"sync"
"crypto/rsa"
"crypto/rand"
"encoding/pem"
"crypto/x509"
"golang.org/x/crypto/ssh"
)
type Tunnel struct {
@ -143,7 +143,7 @@ func (m *TunnelManager) addToAuthorizedKeys(port int) (string, error) {
options := fmt.Sprintf(`command="echo This key permits tunnels only",permitopen="fakehost:1",permitlisten="localhost:%d"`, port)
pubKeyNoNewline := pubKey[:len(pubKey) - 1]
pubKeyNoNewline := pubKey[:len(pubKey)-1]
newAk := fmt.Sprintf("%s%s %s %s%d\n", akStr, options, pubKeyNoNewline, "boringproxy-", port)
err = ioutil.WriteFile("/home/anders/.ssh/authorized_keys", []byte(newAk), 0600)