netrc

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2014 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package netrc implements a parser for netrc file format.

A netrc file usually resides in $HOME/.netrc and is traditionally used by the ftp(1) program to look up login information (username, password, etc.) of remote system(s). The file format is (loosely) described in this man page: http://linux.die.net/man/5/netrc .

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFile

func ParseFile(filename string) ([]*Machine, Macros, error)

ParseFile parses the netrc file identified by filename and returns the set of machine information and macros defined in it. The “default” machine, which is intended to be used when no machine name matches, is identified by an empty machine name. There can be only one “default” machine.

If there is a parsing error, an Error is returned.

Types

type Error

type Error struct {
	Filename string
	LineNum  int    // Line number
	Msg      string // Error message
}

Error represents a netrc file parse error.

func (*Error) Error

func (e *Error) Error() string

Error returns a string representation of error e.

type Machine

type Machine struct {
	Name     string
	Login    string
	Password string
	Account  string
}

Machine contains information about a remote machine.

func FindMachine

func FindMachine(filename, name string) (*Machine, error)

FindMachine parses the netrc file identified by filename and returns the Machine named by name. If no Machine with name name is found, the “default” machine is returned.

type Macros

type Macros map[string]string

Macros contains all the macro definitions in a netrc file.

Jump to

Keyboard shortcuts

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