ipn/ipnserver: use ipnauth.Actor instead of *ipnserver.actor whenever possible

In preparation for adding test coverage for ipn/ipnserver.Server, we update it
to use ipnauth.Actor instead of its concrete implementation where possible.

Updates tailscale/corp#25804

Signed-off-by: Nick Khyl <nickk@tailscale.com>
This commit is contained in:
Nick Khyl
2025-01-11 17:58:27 -06:00
committed by Nick Khyl
parent d818a58a77
commit d0ba91bdb2
2 changed files with 20 additions and 12 deletions
+4 -4
View File
@@ -112,11 +112,11 @@ func (a *actor) Username() (string, error) {
}
type actorOrError struct {
actor *actor
actor ipnauth.Actor
err error
}
func (a actorOrError) unwrap() (*actor, error) {
func (a actorOrError) unwrap() (ipnauth.Actor, error) {
return a.actor, a.err
}
@@ -131,9 +131,9 @@ func contextWithActor(ctx context.Context, logf logger.Logf, c net.Conn) context
return actorKey.WithValue(ctx, actorOrError{actor: actor, err: err})
}
// actorFromContext returns an [actor] associated with ctx,
// actorFromContext returns an [ipnauth.Actor] associated with ctx,
// or an error if the context does not carry an actor's identity.
func actorFromContext(ctx context.Context) (*actor, error) {
func actorFromContext(ctx context.Context) (ipnauth.Actor, error) {
return actorKey.Value(ctx).unwrap()
}