pac

package
v0.0.0-...-8b1022e Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2016 License: Apache-2.0 Imports: 13 Imported by: 0

README

pac

pac is a simple Go library to toggle on and off pac(proxy auto configuration) for Windows, Mac OS and Linux. It will extract a helper tool and use it to actually chage pac.

pac.EnsureHelperToolPresent(fullPath, prompt, iconFullPath)
pac.On(pacUrl string)
pac.Off()

See 'example/main.go' for detailed usage.

Embedding pac-cmd

pac uses binaries from the pac-cmd project.

To embed the binaries for different platforms, use the pac2go.sh script. This script takes care of code signing the Windows and OS X executables.

This script signs the Windows executable, which requires that osslsigncode utility be installed. On OS X with homebrew, you can do this with brew install osslsigncode.

You will also need to set the environment variables BNS_CERT and BNS_CERT_PASS to point to bns-cert.p12 and its password so that the script can sign the Windows executable.

This script also signs the OS X executable, which requires you to install our OS X signing certificate, available here. The password is here.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(name string) ([]byte, error)

Asset loads and returns the asset for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetDir

func AssetDir(name string) ([]string, error)

AssetDir returns the file names below a certain directory embedded in the file by go-bindata. For example if you run go-bindata on data/... and data contains the following hierarchy:

data/
  foo.txt
  img/
    a.png
    b.png

then AssetDir("data") would return []string{"foo.txt", "img"} AssetDir("data/img") would return []string{"a.png", "b.png"} AssetDir("foo.txt") and AssetDir("notexist") would return an error AssetDir("") will return []string{"data"}.

func AssetInfo

func AssetInfo(name string) (os.FileInfo, error)

AssetInfo loads and returns the asset info for the given name. It returns an error if the asset could not be found or could not be loaded.

func AssetNames

func AssetNames() []string

AssetNames returns the names of the assets.

func EnsureHelperToolPresent

func EnsureHelperToolPresent(path string, prompt string, iconFullPath string) (err error)

EnsureHelperToolPresent checks if helper tool exists and extracts it if not. On Mac OS, it also checks and set the file's owner to root:wheel and the setuid bit, it will request user to input password through a dialog to gain the rights to do so. path: absolute or relative path of the file to be checked and generated if not exists. Note - relative paths are resolved relative to the system- specific folder for aplication resources. prompt: the message to be shown on the dialog. iconPath: the full path of the icon to be shown on the dialog.

func Off

func Off(pacUrl string) (err error)

Off sets proxy mode back to direct/none

func On

func On(pacUrl string) (err error)

On tells OS to configure proxy through `pacUrl`

func RestoreAsset

func RestoreAsset(dir, name string) error

Restore an asset under the given directory

func RestoreAssets

func RestoreAssets(dir, name string) error

Restore assets under the given directory recursively

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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