mirror of
https://github.com/tailscale/tailscale.git
synced 2024-11-29 04:55:31 +00:00
61a1644c2a
Updates inetaf/tcpproxy#39 Change-Id: I7fee276b116bd08397347c6c949011d76a2842cf Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
30 lines
815 B
Go
30 lines
815 B
Go
// Copyright (c) Tailscale Inc & AUTHORS
|
|
// SPDX-License-Identifier: BSD-3-Clause
|
|
|
|
//go:build !windows
|
|
|
|
package ipnauth
|
|
|
|
import (
|
|
"net"
|
|
|
|
"github.com/tailscale/peercred"
|
|
"tailscale.com/types/logger"
|
|
)
|
|
|
|
// GetConnIdentity extracts the identity information from the connection
|
|
// based on the user who owns the other end of the connection.
|
|
// and couldn't. The returned connIdentity has NotWindows set to true.
|
|
func GetConnIdentity(_ logger.Logf, c net.Conn) (ci *ConnIdentity, err error) {
|
|
ci = &ConnIdentity{conn: c, notWindows: true}
|
|
_, ci.isUnixSock = c.(*net.UnixConn)
|
|
ci.creds, _ = peercred.Get(c)
|
|
return ci, nil
|
|
}
|
|
|
|
// WindowsToken is unsupported when GOOS != windows and always returns
|
|
// ErrNotImplemented.
|
|
func (ci *ConnIdentity) WindowsToken() (WindowsToken, error) {
|
|
return nil, ErrNotImplemented
|
|
}
|