Back to godoc.org

Package pathconv

v0.0.15
Latest Go to latest

The latest major version is .

Published: Jul 31, 2020 | License: BSD-3-Clause | Module: go.chromium.org/goma/server

Overview

Package pathconv provides path converter between client and server.

TODO: Do we want to introduce ClientPath and ServerPath type so that we won't be confused the path is client path or server path?

Index

type PathConverter

type PathConverter interface {
	// ToClientPath converts a server path to a client path.
	ToClientPath(string) (string, error)

	// ToServerPath converts an absolute client path to a server path.
	ToServerPath(string) (string, error)

	// IsAbsClient reports whether the path is absolute as client path.
	IsAbsClient(string) bool

	// JoinClient joins any number of path elements into a single path.
	JoinClient(elem ...string) string

	// IsSafeClient reports whether the path is safe absolute path
	// (not go out from root directory).
	// It returns false for relative path.
	IsSafeClient(string) bool
}

PathConverter provides path conversion between a client path and a server path. It also provides client path utilities.

func Default

func Default() PathConverter

Default returns a path converter for the case server and client are both same posix path namesystem.

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier