Documentation ¶
Index ¶
- Constants
- Variables
- func Copy(dst io.Writer, src io.Reader, errCh chan error)
- func Forward(num int64) chan error
- func Get(via *net.UnixConn, num int, filenames []string) ([]*os.File, error)
- func GetNum() (int64, error)
- func IsRunning() bool
- func NewClient(node *sshwctl.Node) sshwctl.Client
- func Put(via *net.UnixConn, files ...*os.File) error
- func Setup() error
- func Transport(conn1 io.ReadWriter, conn2 io.ReadWriter) error
- type ChangeWindowRequest
- type ClientRequest
- type Handler
- type JsonProtoReader
- type JsonProtoWriter
- type MasterHandler
- func (m *MasterHandler) CloseConn(w ResponseWriter)
- func (m *MasterHandler) CloseStd(stdConn *StdConn)
- func (m *MasterHandler) Fail(w ResponseWriter, err error)
- func (m *MasterHandler) GetClient(name string) (sshwctl.Client, bool)
- func (m *MasterHandler) Metric()
- func (m *MasterHandler) NewClient(node *sshwctl.Node) (sshwctl.Client, error)
- func (m *MasterHandler) Process(w ResponseWriter, stdConn *StdConn, callables ...func() error)
- func (m *MasterHandler) PutClient(name string, client sshwctl.Client)
- func (m *MasterHandler) Serve(w ResponseWriter, req *Request)
- func (m *MasterHandler) Success(w ResponseWriter, data interface{})
- type PlainResult
- type ProtoReader
- type ProtoWriter
- type Request
- type Response
- type ResponseWriter
- type Server
- type StdConn
- type TimerEntry
- type TimerMap
- func (t *TimerMap) Daemon()
- func (t *TimerMap) Delete(key string)
- func (t *TimerMap) Done(key string)
- func (t *TimerMap) IncrRef(key string)
- func (t *TimerMap) Insert(key string, value interface{}, callback func(key string, value interface{}))
- func (t *TimerMap) Load(key string) (interface{}, bool)
- func (t *TimerMap) Size() int
- type WrapperConn
Constants ¶
const ( PathCreateConn = "createConn" PathStd = "std" PathStdin = "stdin" PathStdout = "stdout" PathStderr = "stderr" PathSession = "session" PathTerminal = PathSession + "/terminal" PathScp = PathSession + "/scp" )
const Delim = '\n'
Variables ¶
var (
SocketPath = path.Join(sshwctl.SshwDir, "sshw.socket")
)
Functions ¶
func Get ¶
Get receives file descriptors from a Unix domain socket.
Num specifies the expected number of file descriptors in one message. Internal files' names to be assigned are specified via optional filenames argument.
You need to close all files in the returned slice. The slice can be non-empty even if this function returns an error.
Use net.FileConn() if you're receiving a network connection.
func Put ¶
Put sends file descriptors to Unix domain socket.
Please note that the number of descriptors in one message is limited and is rather small. Use conn.File() to get a file if you want to put a network connection.
func Transport ¶
func Transport(conn1 io.ReadWriter, conn2 io.ReadWriter) error
Types ¶
type ChangeWindowRequest ¶
type ClientRequest ¶
create a ssh session
type Handler ¶
type Handler interface {
Serve(w ResponseWriter, req *Request)
}
func NewMasterHandler ¶
func NewMasterHandler() Handler
type JsonProtoReader ¶
func (*JsonProtoReader) Read ¶
func (j *JsonProtoReader) Read(i interface{}) error
type JsonProtoWriter ¶
func (*JsonProtoWriter) Write ¶
func (j *JsonProtoWriter) Write(i interface{}) error
type MasterHandler ¶
type MasterHandler struct {
// contains filtered or unexported fields
}
func (*MasterHandler) CloseConn ¶
func (m *MasterHandler) CloseConn(w ResponseWriter)
close serve conn
func (*MasterHandler) CloseStd ¶
func (m *MasterHandler) CloseStd(stdConn *StdConn)
close sshwctl std conn
func (*MasterHandler) Fail ¶
func (m *MasterHandler) Fail(w ResponseWriter, err error)
func (*MasterHandler) GetClient ¶
func (m *MasterHandler) GetClient(name string) (sshwctl.Client, bool)
func (*MasterHandler) Process ¶
func (m *MasterHandler) Process(w ResponseWriter, stdConn *StdConn, callables ...func() error)
func (*MasterHandler) PutClient ¶
func (m *MasterHandler) PutClient(name string, client sshwctl.Client)
func (*MasterHandler) Serve ¶
func (m *MasterHandler) Serve(w ResponseWriter, req *Request)
serve a sshwctl request
func (*MasterHandler) Success ¶
func (m *MasterHandler) Success(w ResponseWriter, data interface{})
type PlainResult ¶
type PlainResult struct { // if code is -1, return error message Message string // -1 fail, 0 success Code int // extension data Data json.RawMessage }
client and server standard response
type ProtoReader ¶
type ProtoReader interface {
Read(i interface{}) error
}
func NewJsonProtoReader ¶
func NewJsonProtoReader(Reader io.Reader) ProtoReader
type ProtoWriter ¶
type ProtoWriter interface {
Write(i interface{}) error
}
func NewJsonProtoWriter ¶
func NewJsonProtoWriter(Writer io.Writer) ProtoWriter
type Request ¶
type Request struct { Path string Body json.RawMessage // reader R ProtoReader `json:"-"` }
type Response ¶
type Response struct {
Body json.RawMessage
}
type Server ¶
func (*Server) ListenAndServe ¶
type TimerEntry ¶
type TimerEntry struct { Key string Value interface{} ExpiredTime time.Time Callback func(key string, value interface{}) ReferNum int64 }
func (*TimerEntry) Done ¶
func (t *TimerEntry) Done()
func (*TimerEntry) IncrRef ¶
func (t *TimerEntry) IncrRef()
func (*TimerEntry) IsExpired ¶
func (t *TimerEntry) IsExpired() bool
func (*TimerEntry) ZeroRef ¶
func (t *TimerEntry) ZeroRef() bool
type TimerMap ¶
to control recycle of resource open a daemon goroutine, poll map periodically and delete data that is expired and zeroRef
func NewTimerMap ¶
func NewTimerMap() *TimerMap
type WrapperConn ¶ added in v1.9.3
type WrapperConn struct {
// contains filtered or unexported fields
}
func (*WrapperConn) Close ¶ added in v1.9.3
func (w *WrapperConn) Close() error