https://github.com/writefreely/go-gopher
[MIRROR: https://git.mills.io/prologic/go-gopher] Gopher (RFC 1436) protocol library for the Go (Golang) programming language supporting both client and server
https://github.com/writefreely/go-gopher
Last synced: about 1 year ago
JSON representation
[MIRROR: https://git.mills.io/prologic/go-gopher] Gopher (RFC 1436) protocol library for the Go (Golang) programming language supporting both client and server
- Host: GitHub
- URL: https://github.com/writefreely/go-gopher
- Owner: writefreely
- License: other
- Created: 2022-04-29T18:16:02.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-05-19T19:59:45.000Z (about 3 years ago)
- Last Synced: 2024-10-29T20:23:23.787Z (over 1 year ago)
- Language: Go
- Homepage:
- Size: 4.47 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Gopher protocol library for Golang
[](https://ci.mills.io/prologic/go-gopher)
This is a standards compliant Gopher library for the Go programming language
implementing the RFC 1436 specification. The library includes both client and
server handling and examples of each.
## Installation
```#!bash
$ go get github.com/writefreely/go-gopher
```
## Usage
```#!go
import "github.com/writefreely/go-gopher"
```
## Example
### Client
```#!go
package main
import (
"fmt"
"github.com/writefreely/go-gopher"
)
func main() {
res, _ := gopher.Get("gopher://gopher.floodgap.com/")
bytes, _ := res.Dir.ToText()
fmt.Println(string(bytes))
}
```
### Server
```#!go
package main
import (
"log"
"github.com/writefreely/go-gopher"
)
func hello(w gopher.ResponseWriter, r *gopher.Request) {
w.WriteInfo("Hello World!")
}
func main() {
gopher.HandleFunc("/hello", hello)
log.Fatal(gopher.ListenAndServe("localhost:70", nil))
}
```
## Related
Related projects:
- [gopherproxy](https://git.mills.io/prologic/gopherproxy)
gopherproxy is Gopher to HTTP proxy that uses go-gopher
for all of its core functionality.
- [gopherclient](https://git.mills.io/prologic/gopherclient)
gopherclient is a cross-platform QT/QML GUI Gopher Client
using the gopherproxy library as its backend.
## License
MIT