Documentation
¶
Index ¶
- Variables
- type Article
- type Auth
- type Client
- func (c *Client) AddArticle(article *Article) error
- func (c *Client) GetAddress() string
- func (c *Client) GetArticle(uuid string) (*Article, error)
- func (c *Client) Md5(data string) string
- func (c *Client) PostBytes(title string, data []byte) (*Response, error)
- func (c *Client) UploadFileAndCheckMd5(filePath string) bool
- type Config
- type HttpInfo
- type Nntp
- type Response
- type Server
- type ServerBackend
- func (tb *ServerBackend) AllowPost() bool
- func (s *ServerBackend) Authenticate(user, pass string) (nntpserver.Backend, error)
- func (s *ServerBackend) Authorized() bool
- func (tb *ServerBackend) GetArticle(group *nntp.Group, id string) (*nntp.Article, error)
- func (tb *ServerBackend) GetArticles(group *nntp.Group, from, to int64) ([]nntpserver.NumberedArticle, error)
- func (tb *ServerBackend) GetGroup(name string) (*nntp.Group, error)
- func (tb *ServerBackend) ListGroups(max int) ([]*nntp.Group, error)
- func (tb *ServerBackend) Post(article *nntp.Article) error
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultBackend = ServerBackend{ // contains filtered or unexported fields }
DefaultBackend 默认后台
Functions ¶
This section is empty.
Types ¶
type Article ¶
type Article struct { Uuid string `json:"uuid"` Group string `json:"group"` Author string `json:"author"` Title string `json:"title"` Content string `json:"content"` Date int `json:"date"` DateString string `json:"date_string"` DateTime time.Time `json:"date_time"` MessageId string `json:"message_id"` }
type Client ¶
type Client struct {
Config *Config
}
Client 客户端对象
func (*Client) GetArticle ¶
GetArticle 根据UUID获取文章
func (*Client) UploadFileAndCheckMd5 ¶
UploadFileAndCheckMd5 上传文件并检查MD5
type Response ¶
type Response struct { StatusCode int `json:"status_code"` Content []byte `json:"content"` Text string `json:"text"` Uuid string `json:"uuid"` }
Response 响应结果
type Server ¶
type Server struct { Config *Config NntpServer *nntpserver.Server }
Server NNTP服务
func (*Server) GetListener ¶
func (s *Server) GetListener() (*net.TCPListener, error)
type ServerBackend ¶
type ServerBackend struct {
// contains filtered or unexported fields
}
ServerBackend 服务后台
func (*ServerBackend) Authenticate ¶
func (s *ServerBackend) Authenticate(user, pass string) (nntpserver.Backend, error)
Authenticate 校验用户名和密码
func (*ServerBackend) GetArticle ¶
func (tb *ServerBackend) GetArticle(group *nntp.Group, id string) (*nntp.Article, error)
GetArticle 获取文章
func (*ServerBackend) GetArticles ¶
func (tb *ServerBackend) GetArticles(group *nntp.Group, from, to int64) ([]nntpserver.NumberedArticle, error)
GetArticles 获取文章列表
func (*ServerBackend) GetGroup ¶
func (tb *ServerBackend) GetGroup(name string) (*nntp.Group, error)
GetGroup 获取分组
func (*ServerBackend) ListGroups ¶
func (tb *ServerBackend) ListGroups(max int) ([]*nntp.Group, error)
ListGroups 分组列表
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
RFC5322 date parsing.
|
RFC5322 date parsing. |
examples
|
|
Package nntp provides base NNTP definitions.
|
Package nntp provides base NNTP definitions. |
client
Package nntpclient provides an NNTP Client.
|
Package nntpclient provides an NNTP Client. |
server
Package nntpserver provides everything you need for your own NNTP server.
|
Package nntpserver provides everything you need for your own NNTP server. |
Click to show internal directories.
Click to hide internal directories.