ircutils

package
v0.0.0-...-f5e0f87 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: ISC Imports: 3 Imported by: 0

Documentation

Overview

Package ircutils provides small, useful utility functions and classes.

This package is in an alpha stage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostnameIsValid

func HostnameIsValid(hostname string) bool

HostnameIsValid provides a way for servers to check whether a looked-up client hostname is valid (see InspIRCd #1033 for why this is required).

This function shouldn't be called by clients since they don't need to validate hostnames for IRC use, just by servers that need to confirm hostnames of incoming clients.

In addition to this function, servers should impose their own limits on max hostname length -- this function limits it to 200 but most servers will probably want to make it smaller than that.

func SanitizeText

func SanitizeText(message string, byteLimit int) (result string)

Sanitizes human-readable text to make it safe for IRC; assumes UTF-8 and uses the replacement character where applicable.

func TruncateUTF8Safe

func TruncateUTF8Safe(message string, byteLimit int) (result string)

truncate a message, taking care not to make valid UTF8 into invalid UTF8

Types

type UserHost

type UserHost struct {
	Nick string
	User string
	Host string
}

UserHost holds a username+host combination

func ParseUserhost

func ParseUserhost(userhost string) UserHost

ParseUserhost takes a userhost string and returns a UserHost instance.

Jump to

Keyboard shortcuts

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