func doBye(w http.ResponseWriter, r *http.Request) {
	s, err := new(w, r)
	if err != nil {
		log.Println(err)
		return
	}
	host, path, port := s.extractHost("bye")
	host = s.checkRemote(host)
	if host == "" {
		return
	}
	n, err := node.MakeNode(host, path, port)
	if err == nil {
		manager.RemoveFromList(n)
	}
	fmt.Fprintln(s.WR, "BYEBYE")
}
doBye  removes from nodelist and says bye to the node specified in url.
package server
import (
	"fmt"
	"io/ioutil"
	"log"
	"math"
	"net"
	"net/http"
	"regexp"
	"strconv"
	"strings"
	"time"
	"github.com/shingetsu-gou/go-nat"
	"github.com/shingetsu-gou/shingetsu-gou/cfg"
	"github.com/shingetsu-gou/shingetsu-gou/cgi"
	"github.com/shingetsu-gou/shingetsu-gou/node"
	"github.com/shingetsu-gou/shingetsu-gou/node/manager"
	"github.com/shingetsu-gou/shingetsu-gou/recentlist"
	"github.com/shingetsu-gou/shingetsu-gou/record"
	"github.com/shingetsu-gou/shingetsu-gou/tag/user"
	"github.com/shingetsu-gou/shingetsu-gou/thread"
	"github.com/shingetsu-gou/shingetsu-gou/updateque"
)
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)
}
func doPing(w http.ResponseWriter, r *http.Request) {
	log.Println(r.Header)
	host, _, err := net.SplitHostPort(r.RemoteAddr)
	if err != nil {
		log.Println(err)
		return
	}
	fmt.Fprint(w, "PONG\n"+host+"\n")
}
func doNode(w http.ResponseWriter, r *http.Request) {
	if manager.ListLen() > 0 {
		fmt.Fprintln(w, manager.GetNodestrSliceInList()[0])
	} else {
		fmt.Fprintln(w, cfg.InitNode.GetData()[0])
	}
}
func doJoin(w http.ResponseWriter, r *http.Request) {
	s, err := new(w, r)
	if err != nil {
		log.Println(err)
		return
	}
	host, path, port := s.extractHost("join")
	host = s.remoteIP(host)
	if host == "" {
		return
	}
	n, err := node.MakeNode(host, path, port)
	if err != nil || !n.IsAllowed() {
		return
	}
	if _, err := n.Ping(); err != nil {
		return
	}
	suggest := manager.ReplaceNodeInList(n)
	if suggest == nil {
		fmt.Fprintln(s.WR, "WELCOME")
		return
	}
	fmt.Fprintf(s.WR, "WELCOME\n%s\n", suggest.Nodestr)
}