go-gopher
所属分类:浏览器
开发工具:GO
文件大小:0KB
下载次数:0
上传日期:2023-05-19 19:59:45
上 传 者:
sh-1993
说明: [MIRROR:https:git.mills.io prologic go-gopher]gopher(RFC 1436)go(Golang)编程语言支持的协议库...,
([MIRROR: https://git.mills.io/prologic/go-gopher] Gopher (RFC 1436) protocol library for the Go (Golang) programming language supporting both client and server)
文件列表:
.drone.yml (411, 2022-04-29)
LICENSE (1098, 2022-04-29)
Makefile (450, 2022-04-29)
_config.yml (26, 2022-04-29)
examples/ (0, 2022-04-29)
examples/client/ (0, 2022-04-29)
examples/client/main.go (750, 2022-04-29)
examples/fileserver/ (0, 2022-04-29)
examples/fileserver/main.go (398, 2022-04-29)
examples/hello/ (0, 2022-04-29)
examples/hello/cert.pem (1090, 2022-04-29)
examples/hello/gencerts.go (4364, 2022-04-29)
examples/hello/key.pem (1679, 2022-04-29)
examples/hello/main.go (1355, 2022-04-29)
go.mod (237, 2022-04-29)
go.sum (1728, 2022-04-29)
gopher.go (32610, 2022-04-29)
gopher_test.go (4370, 2022-04-29)
testdata/ (0, 2022-04-29)
testdata/gophermap (38, 2022-04-29)
testdata/hello.txt (12, 2022-04-29)
# Gopher protocol library for Golang
[![Build Status](https://ci.mills.io/api/badges/prologic/go-gopher/status.svg)](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
近期下载者:
相关文件:
收藏者: