add more godoc strings

This commit is contained in:
Henry 2021-03-16 09:10:44 +01:00
parent 757b14d419
commit 5092f8ef9e
9 changed files with 27 additions and 20 deletions

View File

@ -1,20 +0,0 @@
// SPDX-License-Identifier: MIT
package alias
import (
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
kitlog "github.com/go-kit/kit/log"
refs "go.mindeco.de/ssb-refs"
)
func New(log kitlog.Logger, self refs.FeedRef, aliasDB roomdb.AliasService) Handler {
var h Handler
h.self = self
h.logger = log
h.db = aliasDB
return h
}

View File

@ -1,5 +1,6 @@
// SPDX-License-Identifier: MIT
// Package alias implements the muxrpc handlers for alias needs.
package alias
import (
@ -18,6 +19,7 @@ import (
refs "go.mindeco.de/ssb-refs"
)
// Handler implements the muxrpc methods for alias registration and recvocation
type Handler struct {
logger kitlog.Logger
self refs.FeedRef
@ -25,8 +27,22 @@ type Handler struct {
db roomdb.AliasService
}
// New returns a fresh alias muxrpc handler
func New(log kitlog.Logger, self refs.FeedRef, aliasDB roomdb.AliasService) Handler {
var h Handler
h.self = self
h.logger = log
h.db = aliasDB
return h
}
const sigSuffix = ".sig.ed25519"
// Register is an async muxrpc method handler for registering aliases.
// It receives two string arguments over muxrpc (alias and signature),
// checks the signature confirmation is correct (for this room and signed by the key of theconnection)
// If it is valid, it registers the alias on the roomdb and returns true. If not it returns an error.
func (h Handler) Register(ctx context.Context, req *muxrpc.Request) (interface{}, error) {
var args []string

View File

@ -13,6 +13,7 @@ import (
"github.com/ssb-ngi-pointer/go-ssb-room/muxrpc/handlers/whoami"
)
// instantiate and register the muxrpc handlers
func (s *Server) initHandlers(aliasDB roomdb.AliasService) {
// inistaniate handler packages
whoami := whoami.New(s.Whoami())

View File

@ -12,6 +12,7 @@ import (
"github.com/ssb-ngi-pointer/go-ssb-room/internal/network"
)
// opens the shs listener for TCP connections
func (s *Server) initNetwork() error {
// muxrpc handler creation and authoratization decider
mkHandler := func(conn net.Conn) (muxrpc.Handler, error) {

View File

@ -25,6 +25,7 @@ func WithUNIXSocket(yes bool) Option {
}
}
// creates the UNIX socket file listener for local usage
func (s *Server) initUnixSock() error {
// this races because roomsrv might not be done with init yet
// TODO: refactor network peer code and make unixsock implement that (those will be inited late anyway)

View File

@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
// Package roomsrv implements the muxrpc server for all the room related code.
// It ties the muxrpc/handlers packages and network listeners together.
package roomsrv
import (

View File

@ -15,6 +15,8 @@ import (
weberrors "github.com/ssb-ngi-pointer/go-ssb-room/web/errors"
)
// aliasesHandler implements the managment endpoints for aliases (list and revoke),
// does light validation of the web arguments and passes them through to the roomdb.
type aliasesHandler struct {
r *render.Renderer

View File

@ -1,5 +1,7 @@
// SPDX-License-Identifier: MIT
// Package admin implements the dashboard for admins and moderators to change and control aspects of the room.
// Including aliases, allow/deny list managment, invites and settings of the room.
package admin
import (
@ -18,6 +20,7 @@ import (
"github.com/ssb-ngi-pointer/go-ssb-room/roomstate"
)
// HTMLTemplates define the list of files the template system should load.
var HTMLTemplates = []string{
"admin/dashboard.tmpl",
"admin/menu.tmpl",

View File

@ -15,6 +15,7 @@ import (
"github.com/ssb-ngi-pointer/go-ssb-room/roomdb"
)
// aliasHandler implements the public resolve endpoint for HTML and JSON requests.
type aliasHandler struct {
r *render.Renderer