[MIRROR: https://git.mills.io/prologic/go-gopher] Gopher (RFC 1436) protocol library for the Go (Golang) programming language supporting both client and server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.3 KiB

7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Gopher protocol library for Golang
  2. [![Build Status](https://ci.mills.io/api/badges/prologic/go-gopher/status.svg)](https://ci.mills.io/prologic/go-gopher)
  3. This is a standards compliant Gopher library for the Go programming language
  4. implementing the RFC 1436 specification. The library includes both client and
  5. server handling and examples of each.
  6. ## Installation
  7. ```#!bash
  8. $ go get code.as/writefreely/go-gopher
  9. ```
  10. ## Usage
  11. ```#!go
  12. import "code.as/writefreely/go-gopher"
  13. ```
  14. ## Example
  15. ### Client
  16. ```#!go
  17. package main
  18. import (
  19. "fmt"
  20. "code.as/writefreely/go-gopher"
  21. )
  22. func main() {
  23. res, _ := gopher.Get("gopher://gopher.floodgap.com/")
  24. bytes, _ := res.Dir.ToText()
  25. fmt.Println(string(bytes))
  26. }
  27. ```
  28. ### Server
  29. ```#!go
  30. package main
  31. import (
  32. "log"
  33. "code.as/writefreely/go-gopher"
  34. )
  35. func hello(w gopher.ResponseWriter, r *gopher.Request) {
  36. w.WriteInfo("Hello World!")
  37. }
  38. func main() {
  39. gopher.HandleFunc("/hello", hello)
  40. log.Fatal(gopher.ListenAndServe("localhost:70", nil))
  41. }
  42. ```
  43. ## Related
  44. Related projects:
  45. - [gopherproxy](https://git.mills.io/prologic/gopherproxy)
  46. gopherproxy is Gopher to HTTP proxy that uses go-gopher
  47. for all of its core functionality.
  48. - [gopherclient](https://git.mills.io/prologic/gopherclient)
  49. gopherclient is a cross-platform QT/QML GUI Gopher Client
  50. using the gopherproxy library as its backend.
  51. ## License
  52. MIT