示例#1
0
//Setup setups handlers for 2ch interface.
func Setup(s *cgi.LoggingServeMux) {
	log.Println("start 2ch interface")
	rtr := mux.NewRouter()

	cgi.RegistToRouter(rtr, "/2ch/", boardApp)
	cgi.RegistToRouter(rtr, "/2ch/dat/{datkey:[^\\.]+}.dat", threadApp)
	cgi.RegistToRouter(rtr, "/2ch/{board:[^/]+}/subject.txt", subjectApp)
	cgi.RegistToRouter(rtr, "/2ch/subject.txt", subjectApp)
	cgi.RegistToRouter(rtr, "/2ch/{board:[^/]+}/head.txt", headApp)
	cgi.RegistToRouter(rtr, "/2ch/head.txt", headApp)
	s.Handle("/2ch/", handlers.CompressHandler(rtr))

	s.RegistCompressHandler("/test/bbs.cgi", postCommentApp)
}
示例#2
0
//Setup setups handlers for server.cgi
func Setup(s *cgi.LoggingServeMux) {
	s.RegistCompressHandler(cfg.ServerURL+"/ping", doPing)
	s.RegistCompressHandler(cfg.ServerURL+"/node", doNode)
	s.RegistCompressHandler(cfg.ServerURL+"/join/", doJoin)
	s.RegistCompressHandler(cfg.ServerURL+"/bye/", doBye)
	s.RegistCompressHandler(cfg.ServerURL+"/have/", doHave)
	s.RegistCompressHandler(cfg.ServerURL+"/get/", doGetHead)
	s.RegistCompressHandler(cfg.ServerURL+"/head/", doGetHead)
	s.RegistCompressHandler(cfg.ServerURL+"/update/", doUpdate)
	s.RegistCompressHandler(cfg.ServerURL+"/recent/", doRecent)
	s.RegistCompressHandler(cfg.ServerURL+"/", doMotd)

}
//Setup setups handlers for gateway.cgi
func Setup(s *cgi.LoggingServeMux) {
	s.RegistCompressHandler(cfg.GatewayURL+"/motd", printMotd)
	s.RegistCompressHandler(cfg.GatewayURL+"/mergedjs", printMergedJS)
	s.RegistCompressHandler(cfg.GatewayURL+"/rss", printRSS)
	s.RegistCompressHandler(cfg.GatewayURL+"/recent_rss", printRecentRSS)
	s.RegistCompressHandler(cfg.GatewayURL+"/index", printGatewayIndex)
	s.RegistCompressHandler(cfg.GatewayURL+"/changes", printIndexChanges)
	s.RegistCompressHandler(cfg.GatewayURL+"/recent", printRecent)
	s.RegistCompressHandler(cfg.GatewayURL+"/new", printNew)
	s.RegistCompressHandler(cfg.GatewayURL+"/thread", printGatewayThread)
	s.RegistCompressHandler(cfg.GatewayURL+"/", PrintTitle)
	s.RegistCompressHandler(cfg.GatewayURL+"/csv/index/", printCSV)
	s.RegistCompressHandler(cfg.GatewayURL+"/csv/changes/", printCSVChanges)
	s.RegistCompressHandler(cfg.GatewayURL+"/csv/recent/", printCSVRecent)
}