Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
|
b6b245c65e | |
|
c7bd31c631 | |
|
d288c96f2d | |
|
9da29de05b | |
|
b00f9a5605 | |
|
024a2c75e9 | |
|
cfda71a3aa |
|
@ -0,0 +1,27 @@
|
||||||
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
_obj
|
||||||
|
_test
|
||||||
|
|
||||||
|
# Architecture specific extensions/prefixes
|
||||||
|
*.[568vq]
|
||||||
|
[568vq].out
|
||||||
|
|
||||||
|
*.cgo1.go
|
||||||
|
*.cgo2.c
|
||||||
|
_cgo_defun.c
|
||||||
|
_cgo_gotypes.go
|
||||||
|
_cgo_export.*
|
||||||
|
|
||||||
|
_testmain.go
|
||||||
|
|
||||||
|
# Binaries
|
||||||
|
*.exe
|
||||||
|
/pixelqr
|
||||||
|
|
||||||
|
# Test files
|
||||||
|
*.test
|
|
@ -0,0 +1,15 @@
|
||||||
|
FROM golang:1.9-alpine
|
||||||
|
|
||||||
|
COPY . ${GOPATH}/src/git.icedream.tech/icedream/pixelqr
|
||||||
|
RUN cd "${GOPATH}/src/git.icedream.tech/icedream/pixelqr/testssh" \
|
||||||
|
&& apk add --no-cache --virtual .build-deps git \
|
||||||
|
&& echo == Downloading... == \
|
||||||
|
&& go get -v -d ./... \
|
||||||
|
&& echo == Building... == \
|
||||||
|
&& go build -v \
|
||||||
|
&& mv testssh /usr/local/bin \
|
||||||
|
&& cd / \
|
||||||
|
&& rm -r ${GOPATH} \
|
||||||
|
&& apk del --no-cache .build-deps
|
||||||
|
|
||||||
|
CMD ["testssh"]
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
_obj
|
||||||
|
_test
|
||||||
|
|
||||||
|
# Architecture specific extensions/prefixes
|
||||||
|
*.[568vq]
|
||||||
|
[568vq].out
|
||||||
|
|
||||||
|
*.cgo1.go
|
||||||
|
*.cgo2.c
|
||||||
|
_cgo_defun.c
|
||||||
|
_cgo_gotypes.go
|
||||||
|
_cgo_export.*
|
||||||
|
|
||||||
|
_testmain.go
|
||||||
|
|
||||||
|
testssh
|
||||||
|
*.exe
|
||||||
|
*.test
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||||
|
*.o
|
||||||
|
*.a
|
||||||
|
*.so
|
||||||
|
|
||||||
|
# Folders
|
||||||
|
_obj
|
||||||
|
_test
|
||||||
|
|
||||||
|
# Architecture specific extensions/prefixes
|
||||||
|
*.[568vq]
|
||||||
|
[568vq].out
|
||||||
|
|
||||||
|
*.cgo1.go
|
||||||
|
*.cgo2.c
|
||||||
|
_cgo_defun.c
|
||||||
|
_cgo_gotypes.go
|
||||||
|
_cgo_export.*
|
||||||
|
|
||||||
|
_testmain.go
|
||||||
|
|
||||||
|
testssh
|
||||||
|
*.exe
|
||||||
|
*.test
|
|
@ -0,0 +1,45 @@
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"io"
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"github.com/fatih/color"
|
||||||
|
"github.com/gliderlabs/ssh"
|
||||||
|
"github.com/qpliu/qrencode-go/qrencode"
|
||||||
|
|
||||||
|
"git.icedream.tech/icedream/pixelqr/internal"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
greeting := "https://git.icedream.tech/icedream/pixelqr"
|
||||||
|
|
||||||
|
color.NoColor = false
|
||||||
|
|
||||||
|
ssh.Handle(func(s ssh.Session) {
|
||||||
|
grid, err := qrencode.Encode(greeting, qrencode.ECLevelQ)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
w := new(bytes.Buffer)
|
||||||
|
err = internal.ConvertGridToUnicode(w, grid)
|
||||||
|
if err != nil {
|
||||||
|
log.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
qrs := string(w.Bytes())
|
||||||
|
|
||||||
|
io.WriteString(s, "Scan this QR code for the link to the library that generated it:\n\n")
|
||||||
|
io.WriteString(s, qrs)
|
||||||
|
io.WriteString(s, "\n\nThank you!\n")
|
||||||
|
|
||||||
|
for err == nil {
|
||||||
|
_, err = s.Read([]byte{})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
log.Fatal(ssh.ListenAndServe(":2020", nil))
|
||||||
|
}
|
Loading…
Reference in New Issue