ctlsocksrv

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package ctlsocksrv implements the control socket interface that can be activated by passing "-ctlsock" on the command line.

Index

Constants

View Source
const ReadBufSize = 5000

ReadBufSize is the size of the request read buffer. The longest possible path is 4096 bytes on Linux and 1024 on Mac OS X so 5000 bytes should be enough to hold the whole JSON request. This assumes that the path does not contain too many characters that had to be be escaped in JSON (for example, a null byte blows up to "\u0000"). We abort the connection if the request is bigger than this.

Variables

This section is empty.

Functions

func SanitizePath

func SanitizePath(path string) string

SanitizePath adapts filepath.Clean for FUSE paths.

  1. Leading slash(es) are dropped
  2. It returns "" instead of "."
  3. If the cleaned path points above CWD (start with ".."), an empty string is returned

See the TestSanitizePath testcases for examples.

func Serve

func Serve(sock net.Listener, fs Interface)

Serve serves incoming connections on "sock". This call blocks so you probably want to run it in a new goroutine.

Types

type Interface

type Interface interface {
	EncryptPath(string) (string, error)
	DecryptPath(string) (string, error)
}

Interface should be implemented by fusefrontend[_reverse]

Jump to

Keyboard shortcuts

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