Documentation
¶
Overview ¶
Package tftp implents a TFTP server RFC1350 and also RFC2348 and RFC2348 It also has a simple ACL for clients to allow or disallow Read/Write requests and give an own directory for Read/Write request
Index ¶
- func ListenAndServe(addr, rootdir string) error
- type ACL
- type Client
- type TServer
- func (ts *TServer) AddACL(hostornet string, write, read bool, writedir, readdir string) error
- func (ts *TServer) AddACLStruct(hostornet string, acl *ACL) error
- func (ts TServer) CheckClient(opcode uint16, caddr *net.UDPAddr) (bool, string)
- func (ts *TServer) DelACL(hostornet string) error
- func (ts *TServer) Serve() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
ListenAndServe starts UDP socket and waits for client first packet
Types ¶
type Client ¶
type Client struct {
Addr *net.UDPAddr
Conn *net.UDPConn
BlockSize int
TimeOut int
Tsize uint16
BlockNumber uint16
Options map[string][]byte
Databuf []byte
ReadDir string
WriteDir string
// contains filtered or unexported fields
}
Client holds info from one client
func (*Client) NewTransfer ¶
NewTransfer starts a new transfer from client WRQ
type TServer ¶
type TServer struct {
ACLs map[*net.IPNet]*ACL
DefWrite bool
DefWriteDir string
DefRead bool
DefReadDir string
// contains filtered or unexported fields
}
TServer struct holds info from Server
func NewServer ¶
func NewServer(netw, addr, rootdir, defaultreaddir, defaultwritedir string, defread, defwrite bool) (*TServer, error)
NewServer initalize an TServer
func (*TServer) AddACLStruct ¶
AddACLStruct adds acl struct directly
func (TServer) CheckClient ¶
CheckClient checks client address against ACL-map returns true when client is allowed false otherwise
Click to show internal directories.
Click to hide internal directories.