gowhoson is a golang implementation of the "Whoson" protocol.
Whoson ("WHO iS ONline") is a proposed Internet protocol that allows Internet server programs know if a particular (dynamically allocated) IP address is currently allocated to a known (trusted) user and, optionally, the identity of the said user. The protocol could be used by an SMTP Message Transfer System in conjunction with anti-spam-relaying filters to implement a scheme similar to the one described here to allow roaming customers use their "home" SMTP server to submit email while connected from a "foreign" network.
- "Whoson" Project page. http://whoson.sourceforge.net/.
- About the "Whoson" protocol. http://whoson.sourceforge.net/whoson.txt
Server 01
func main() {
whoson.ListenAndServe("tcp", ":9876")
}
Server 02
func main() {
addr := net.TCPAddr{
Port: 9876,
IP: net.ParseIP("127.0.0.1"),
}
l, err := net.ListenTCP("tcp", &addr)
if err != nil {
log.Fatalf("%v", err)
}
whoson.ServeTCP(l)
}
Client
func main() {
client, err := whoson.Dial("tcp", "127.0.0.1:9876")
if err != nil {
log.Fatalf("%v", err)
}
defer client.Quit()
res, err := client.Login("192.168.0.1", "[email protected]")
if err != nil {
log.Fatalf("%v", err)
}
fmt.Println(res.String())
}
$ go get -u github.com/tai-ga/gowhoson/cmd/gowhoson
Server
> gowhoson server -h
NAME:
gowhoson server - gowhoson server mode
USAGE:
gowhoson server [command options] [arguments...]
OPTIONS:
--tcp value e.g. [ServerIP:Port|nostart] [$GOWHOSON_SERVER_TCP]
--udp value e.g. [ServerIP:Port|nostart] [$GOWHOSON_SERVER_UDP]
--log value e.g. [stdout|stderr|discard] or "/var/log/filename.log" [$GOWHOSON_SERVER_LOG]
--loglevel value e.g. [debug|info|warn|error|dpanic|panic|fatal] [$GOWHOSON_SERVER_LOGLEVEL]
--serverid value e.g. [1000] (default: 0) [$GOWHOSON_SERVER_SERVERID]
--expvar e.g. (default: false) [$GOWHOSON_SERVER_EXPVAR]
Client
> gowhoson client -h
NAME:
gowhoson client - gowhoson client mode
USAGE:
gowhoson client command [command options] [arguments...]
COMMANDS:
login whoson command "LOGIN"
query whoson command "QUERY"
logout whoson command "LOGOUT"
editconfig edit client configration file
OPTIONS:
--help, -h show help
- LOGIN
- LOGOUT
- QUERY
- QUIT
- Original reference implementation of whoson.
- Many japanese gopher products.
- 🎉 Many Thanks! 🎉
- fork a repository: github.com/tai-ga/gowhoson to github.com/you/repo
- get original code: go get github.com/tai-ga/gowhoson
- work on original code
- add remote to your repo: git remote add myfork https://github.com/you/repo.git
- push your changes: git push myfork
- create a new Pull Request
MIT
Masahiro Ono (@tai-ga)