identd

package
v1.5.1-0...-475df33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package identd implements the RFC1413 identd server and oidentd config generation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandHome

func ExpandHome(shortenedPath string) string

ExpandHome mirrors server/helper.ts's expandHome. Kept as a thin re-export of internal/pathutil.ExpandHome (the now-canonical implementation - see that package's doc comment) so existing callers and this package's own tests don't need to change.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server mirrors identification.ts's Identification class.

func New

func New(oidentdFile string) *Server

New mirrors the constructor's oidentd-file half: if oidentdFile is non-empty (Config.values.oidentd, already expanded via ExpandHome by the caller), an initial (empty) oidentd file is written immediately, exactly like the TS constructor calling this.refresh() before any sockets exist. The RFC1413 listener half is started separately via ListenAndServe - split out because Go prefers returning errors over a callback, and because "should identd's own listener run" (Config.values.identd.enable) is an orthogonal decision from "is oidentd file generation configured".

func (*Server) AddSocket

func (s *Server) AddSocket(conn net.Conn, user string) int

AddSocket mirrors Identification.addSocket: register a newly connected outbound socket under the given local username, returning an id for the matching RemoveSocket call once it closes.

func (*Server) Close

func (s *Server) Close() error

Close stops the RFC1413 listener, if running.

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(bind string, port int) error

ListenAndServe mirrors the constructor's `Config.values.identd.enable` branch: binds the RFC1413 listener and serves connections until Close is called or Accept fails. Meant to be run in its own goroutine.

func (*Server) Refresh

func (s *Server) Refresh()

Refresh mirrors Identification.refresh: regenerates the oidentd config file from every currently registered connection. A no-op (skips the write) when no oidentd file is configured, matching the TS `if (this.oidentdFile) { ... }` guard - the file contents are still built either way in Node, but there's nothing to build them for here if they're never written.

func (*Server) RemoveSocket

func (s *Server) RemoveSocket(id int)

RemoveSocket mirrors Identification.removeSocket.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL