begin web control interface
This commit is contained in:
@ -15,4 +15,4 @@ RUN go get -u github.com/eyedeekay/sam-forwarder/samcatd
|
||||
RUN make all install
|
||||
USER $user
|
||||
WORKDIR /opt/$user/
|
||||
CMD samcatd -f /usr/src/eephttpd/etc/samcatd/eephttpd.conf
|
||||
CMD samcatd -f /usr/src/eephttpd/etc/samcatd/tunnels.ini -littleboss start
|
||||
|
4
Makefile
4
Makefile
@ -148,7 +148,7 @@ example-config:
|
||||
|
||||
|
||||
docker-build:
|
||||
docker build \
|
||||
docker build --no-cache \
|
||||
--build-arg user=$(samcatd) \
|
||||
-f Dockerfile \
|
||||
-t eyedeekay/$(samcatd) .
|
||||
@ -174,7 +174,7 @@ c:
|
||||
follow:
|
||||
docker logs -f $(samcatd)
|
||||
|
||||
docker: docker-build docker-volume docker-run
|
||||
docker: docker-build docker-run
|
||||
|
||||
index:
|
||||
pandoc README.md -o docs/index.html
|
||||
|
@ -4,8 +4,7 @@ Forward a local port to i2p over the SAM API, or proxy a destination to a port
|
||||
on the local host. This is a work-in-progress, but the basic functionality is,
|
||||
there and it's already pretty useful. Everything TCP works, but UDP forwarding
|
||||
has much less real use than TCP. Turns out UDP was less broken than I thought
|
||||
though. Yay. There's also a simple client-server VPN built on top of it,
|
||||
eventually, it will be replaced with a peer-to-peer version.
|
||||
though.
|
||||
|
||||
Since it seems to be doing UDP now, if you'd like to donate to further
|
||||
development there are some wallet addresses at the bottom of this readme for
|
||||
|
@ -69,6 +69,38 @@ a {
|
||||
h1 {
|
||||
background-color: #9e9e9e;
|
||||
}
|
||||
.linkstyle {
|
||||
align-items: normal;
|
||||
background-color: rgba(0,0,0,0);
|
||||
border-color: rgb(0, 0, 238);
|
||||
border-style: none;
|
||||
box-sizing: content-box;
|
||||
color: rgb(0, 0, 238);
|
||||
cursor: pointer;
|
||||
display: inline;
|
||||
font: inherit;
|
||||
height: auto;
|
||||
padding: 0;
|
||||
perspective-origin: 0 0;
|
||||
text-align: start;
|
||||
text-decoration: underline;
|
||||
transform-origin: 0 0;
|
||||
width: auto;
|
||||
-moz-appearance: none;
|
||||
-webkit-logical-height: 1em; /* Chrome ignores auto, so we have to use this hack to set the correct height */
|
||||
-webkit-logical-width: auto; /* Chrome ignores auto, but here for completeness */
|
||||
}
|
||||
|
||||
@supports (-moz-appearance:none) { /* Mozilla-only */
|
||||
.linkstyle::-moz-focus-inner { /* reset any predefined properties */
|
||||
border: none;
|
||||
padding: 0;
|
||||
}
|
||||
.linkstyle:focus { /* add outline to focus pseudo-class */
|
||||
outline-style: dotted;
|
||||
outline-width: 1px;
|
||||
}
|
||||
}
|
||||
`
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,16 @@ func (t *TunnelHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
if strings.HasSuffix(req.URL.Path, "color") {
|
||||
fmt.Fprintf(rw, " <div id=\"%s\" class=\"%s\" >", t.SAMTunnel.ID(), t.SAMTunnel.GetType())
|
||||
}
|
||||
if err := req.ParseForm(); err == nil {
|
||||
if action := req.PostFormValue("action"); action != "" {
|
||||
fmt.Fprintf(rw, "%s", action)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
t.Printdivf(t.SAMTunnel.ID(), "TunName", t.SAMTunnel.ID(), rw, req)
|
||||
fmt.Fprintf(rw, " <span id=\"toggle%s\" class=\"control\">\n", t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <a href=\"#\" onclick=\"toggle_visibility_class('%s');\"> Show/Hide %s</a>\n", t.SAMTunnel.ID(), t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <a href=\"#\" onclick=\"toggle_visibility_class('%s');\"> Show/Hide %s</a><br>\n", t.SAMTunnel.ID(), t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <a href=\"/%s/color\">Tunnel page</a>\n", t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " </span>\n")
|
||||
for key, value := range t.SAMTunnel.Props() {
|
||||
@ -56,9 +63,21 @@ func (t *TunnelHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
|
||||
if strings.HasSuffix(req.URL.Path, "color") {
|
||||
fmt.Fprintf(rw, " <div id=\"%s\" class=\"%s control panel\" >", t.SAMTunnel.ID()+".control", t.SAMTunnel.GetType())
|
||||
}
|
||||
fmt.Fprintf(rw, " <a href=\"/%s/start\">.[START]</a>", t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <a href=\"/%s/stop\">.[STOP].</a>", t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <a href=\"/%s/restart\">[RESTART].</a><br>", t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"start\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"start\" name=\"action\" />")
|
||||
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\".[START]\">")
|
||||
fmt.Fprintf(rw, " </form>")
|
||||
|
||||
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"stop\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"stop\" name=\"action\" />")
|
||||
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\".[STOP].\">")
|
||||
fmt.Fprintf(rw, " </form>")
|
||||
|
||||
fmt.Fprintf(rw, " <form class=\"linkstyle\" name=\"restart\" action=\"/%s\" method=\"post\">", t.SAMTunnel.ID())
|
||||
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"hidden\" value=\"restart\" name=\"action\" />")
|
||||
fmt.Fprintf(rw, " <input class=\"linkstyle\" type=\"submit\" value=\"[RESTART].\">")
|
||||
fmt.Fprintf(rw, " </form>")
|
||||
|
||||
fmt.Fprintf(rw, " <div id=\"%s.status\" class=\"%s status\">.[STATUS].</div>", t.SAMTunnel.ID(), t.SAMTunnel.ID())
|
||||
if strings.HasSuffix(req.URL.Path, "color") {
|
||||
fmt.Fprintf(rw, " </div>\n\n")
|
||||
|
Reference in New Issue
Block a user