peercred

package module
v0.0.0-...-b535050 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: BSD-3-Clause Imports: 6 Imported by: 3

README

peercred

Documentation

Overview

Package peercred maps from a net.Conn to information about the other side of the connection, using various OS-specific facilities.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImplemented      = errors.New("not implemented on " + runtime.GOOS)
	ErrUnsupportedConnType = errors.New("unsupported connection type")
)

Functions

This section is empty.

Types

type Creds

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

Creds are the peer credentials.

func Get

func Get(c net.Conn) (*Creds, error)

Get returns the peer credentials for c.

For unsupported system, the error is ErrNotImplemented.

func (*Creds) PID

func (c *Creds) PID() (pid int, ok bool)

func (*Creds) UserID

func (c *Creds) UserID() (uid string, ok bool)

UserID returns the userid (or Windows SID) that owns the other side of the connection, if known. (ok is false if not known) The returned string is suitable to passing to os/user.LookupId.

Jump to

Keyboard shortcuts

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