项目作者: jmhobbs

项目描述 :
A Gopher protocol library for Go
高级语言: Go
项目地址: git://github.com/jmhobbs/gopher.git
创建时间: 2019-03-03T03:24:45Z
项目社区:https://github.com/jmhobbs/gopher

开源协议:

下载


Build Status codecov GoDoc

Gopher Go

This is a toy library for implementing gopher protocol servers in Go.

It’s loosely structured after net/http and is api unstable.

Usage

  1. s := gopher.Server{}
  2. h := gopher.HandleFunc(func(resp gopher.Response, req gopher.Request) {
  3. resp.WriteMenu(gopher.Menu{[]gopher.Link{
  4. gopher.Link{gopher.TextFile, "About", "/about", "localhost", 7070},
  5. gopher.Link{gopher.FullTextSearch, "Search", "/search", "localhost", 7070},
  6. }})
  7. resp.Write([]byte("Welcome to my Gopher hole!"))
  8. resp.End()
  9. }
  10. s.ListenAndServe("127.0.0.1:7070", h))