diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2021-09-10 12:47:19 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2021-09-10 12:47:19 +0200 |
commit | 7e72caa092194306ba6b5c6b58e6262fdd1fd72c (patch) | |
tree | a708f77cc188fb49b72dae608e100bb8ac0b4420 /client_conn.go | |
parent | 04d33fd100b67da504b16d9f98baa255d5060028 (diff) |
Document exported code (#49)
Diffstat (limited to 'client_conn.go')
-rw-r--r-- | client_conn.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/client_conn.go b/client_conn.go index f21d48c..343b323 100644 --- a/client_conn.go +++ b/client_conn.go @@ -23,6 +23,7 @@ const ( csSudo ) +// A ClientConn is a connection to a minetest client. type ClientConn struct { mt.Peer srv *ServerConn @@ -60,6 +61,7 @@ type ClientConn struct { modChs map[string]struct{} } +// Name returns the player name of the ClientConn. func (cc *ClientConn) Name() string { return cc.name } func (cc *ClientConn) server() *ServerConn { @@ -69,6 +71,8 @@ func (cc *ClientConn) server() *ServerConn { return cc.srv } +// ServerName returns the name of the current upstream server +// of the ClientConn. It is empty if there is no upstream connection. func (cc *ClientConn) ServerName() string { srv := cc.server() if srv != nil { @@ -92,8 +96,12 @@ func (cc *ClientConn) setState(state clientState) { cc.cstate = state } +// Init returns a channel that is closed +// when the ClientConn enters the csActive state. func (cc *ClientConn) Init() <-chan struct{} { return cc.initCh } +// Log logs an interaction with the ClientConn. +// dir indicates the direction of the interaction. func (cc *ClientConn) Log(dir string, v ...interface{}) { if cc.Name() != "" { format := "{%s, %s} %s {←|⇶}" |