aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoraqua <aqua@iserlohn-fortress.net>2021-08-04 11:57:26 +0300
committeraqua <aqua@iserlohn-fortress.net>2021-08-04 11:57:26 +0300
commit479cd8d24eda5edf63235210112e4c5ddfa6f370 (patch)
treea771e6c1c988f7f6539927bee16d8b27b53f5422
parentgemcat can now do multiple requests at once (diff)
downloadgemcat-479cd8d24eda5edf63235210112e4c5ddfa6f370.tar.xz
Move gemini code into its own module
-rw-r--r--gemini/gemini.go (renamed from gemini.go)2
-rw-r--r--gemini/gemini_test.go (renamed from gemini_test.go)2
-rw-r--r--gemini/go.mod3
-rw-r--r--go.mod8
-rw-r--r--main.go8
5 files changed, 17 insertions, 6 deletions
diff --git a/gemini.go b/gemini/gemini.go
index 1cdef8b..8f4c6ef 100644
--- a/gemini.go
+++ b/gemini/gemini.go
@@ -1,4 +1,4 @@
-package main
+package gemini
import (
"crypto/tls"
diff --git a/gemini_test.go b/gemini/gemini_test.go
index efa34b9..ffd2588 100644
--- a/gemini_test.go
+++ b/gemini/gemini_test.go
@@ -1,4 +1,4 @@
-package main
+package gemini
import (
"bytes"
diff --git a/gemini/go.mod b/gemini/go.mod
new file mode 100644
index 0000000..228a120
--- /dev/null
+++ b/gemini/go.mod
@@ -0,0 +1,3 @@
+module gemini
+
+go 1.16
diff --git a/go.mod b/go.mod
index 51942f3..8604a2a 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,11 @@
module gemcat
go 1.16
+
+require (
+ gemini v0.0.0
+)
+
+replace (
+ gemini => ./gemini
+)
diff --git a/main.go b/main.go
index 2079568..3cfacac 100644
--- a/main.go
+++ b/main.go
@@ -4,6 +4,7 @@ import (
"bufio"
"flag"
"fmt"
+ "gemini"
"log"
"os"
)
@@ -48,7 +49,7 @@ func main() {
output string
}{
host: "",
- port: GeminiPort,
+ port: gemini.GeminiPort,
input: "",
output: "",
}
@@ -60,7 +61,6 @@ func main() {
flag.StringVar(&flags.output, "o", flags.output, "write output to path")
flag.Parse()
-
requests, err := read_requests(flags.input)
if err != nil {
log.Panic(err)
@@ -79,9 +79,9 @@ func main() {
log.Printf("Got %d requests\n", len(requests))
for _, request := range requests {
log.Println(request)
- if conn, err := NewGeminiConnFromRequest(request, flags.port); err != nil {
+ if conn, err := gemini.NewGeminiConnFromRequest(request, flags.port); err != nil {
log.Print(err)
- } else if err := conn.Get(FormatRequest(request), output); err != nil {
+ } else if err := conn.Get(gemini.FormatRequest(request), output); err != nil {
log.Print(err)
}
}