Skip to content

Commit

Permalink
add more godoc strings
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptix committed Mar 16, 2021
1 parent 757b14d commit 5092f8e
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 20 deletions.
20 changes: 0 additions & 20 deletions muxrpc/handlers/alias/plugin.go

This file was deleted.

16 changes: 16 additions & 0 deletions muxrpc/handlers/alias/register.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: MIT

// Package alias implements the muxrpc handlers for alias needs.
package alias

import (
Expand All @@ -18,15 +19,30 @@ 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

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

Expand Down
1 change: 1 addition & 0 deletions roomsrv/init_handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions roomsrv/init_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions roomsrv/init_unixsock.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 2 additions & 0 deletions roomsrv/server.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand Down
2 changes: 2 additions & 0 deletions web/handlers/admin/aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions web/handlers/admin/handler.go
Original file line number Diff line number Diff line change
@@ -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 (
Expand All @@ -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",
Expand Down
1 change: 1 addition & 0 deletions web/handlers/aliases.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 5092f8e

Please sign in to comment.