Documentation
¶
Index ¶
- Constants
- func New(opts ...NodeOption)
- func NewDirect(opt *YockdClientOption) yocki.YockdClient
- func OptionTransportCreds(c, k string, cas ...string) grpc.DialOption
- func ParseProto[T yocki.Protocal](msg string) T
- type Context
- type DeliveryClient
- func (c *DeliveryClient) Call(node, method string, args ...string) (string, error)
- func (c *DeliveryClient) Close()
- func (c *DeliveryClient) Dial(form, to *pb.NodeInfo) error
- func (c *DeliveryClient) Download(file string) error
- func (c *DeliveryClient) FileSystemGet(src, dst string) error
- func (c *DeliveryClient) FileSystemPut(src, dst string) error
- func (c *DeliveryClient) Info() (string, error)
- func (DeliveryClient) IsPublic() bool
- func (c *DeliveryClient) MakeTunnel(name string, ctx context.Context, p yocki.Promise, e chan yocki.PromiseEvent) error
- func (c *DeliveryClient) Mark(name, addr string) error
- func (c *DeliveryClient) Name() string
- func (c *DeliveryClient) Ping() error
- func (c *DeliveryClient) ProcessFind(pid int64, cmd string) ([]*pb.Process, error)
- func (c *DeliveryClient) ProcessKill(pid int64) error
- func (c *DeliveryClient) ProcessList() ([]*pb.Process, error)
- func (c *DeliveryClient) ProcessSpawn(t pb.ProcessSpawnType, spec, cmd string) (int64, error)
- func (c *DeliveryClient) SignalClear(sigs ...string) error
- func (c *DeliveryClient) SignalInfo(sig string) (bool, bool, error)
- func (c *DeliveryClient) SignalList() ([]string, error)
- func (c *DeliveryClient) SignalNotify(sig string) error
- func (c *DeliveryClient) SignalWait(sig string) (bool, error)
- func (c *DeliveryClient) Status()
- type DirectClient
- func (c *DirectClient) Call(node, method string, args ...string) (string, error)
- func (client *DirectClient) Close()
- func (c *DirectClient) Dial(from, to *pb.NodeInfo) error
- func (c *DirectClient) FileSystemDownload(file string) error
- func (c *DirectClient) FileSystemGet(src, dst string) error
- func (c *DirectClient) FileSystemPut(src, dst string) error
- func (c *DirectClient) Info() (string, error)
- func (c *DirectClient) IsPublic() bool
- func (c *DirectClient) MakeTunnel(name string, ctx context.Context, promise yocki.Promise, ...) error
- func (c *DirectClient) Mark(name, addr string) error
- func (client *DirectClient) Name() string
- func (c *DirectClient) Ping() error
- func (c *DirectClient) ProcessFind(pid int64, cmd string) ([]*pb.Process, error)
- func (c *DirectClient) ProcessKill(pid int64) error
- func (c *DirectClient) ProcessList() ([]*pb.Process, error)
- func (c *DirectClient) ProcessSpawn(t pb.ProcessSpawnType, spec, cmd string) (int64, error)
- func (c *DirectClient) Register(addrs ...string) ([]string, error)
- func (c *DirectClient) SignalClear(sigs ...string) error
- func (c *DirectClient) SignalInfo(sig string) (bool, bool, error)
- func (c *DirectClient) SignalList() ([]string, error)
- func (c *DirectClient) SignalNotify(sig string) error
- func (c *DirectClient) SignalWait(sig string) (bool, error)
- func (client *DirectClient) Status()
- func (c *DirectClient) Unregister(addrs ...string) error
- func (c *DirectClient) Upload(file string) error
- type EstablishProtocal
- type MethodCallProtocal
- type NetAddr
- type NetworkManager
- type Node
- type NodeOption
- type P2PProtocal
- type PeerAddr
- type Protocal
- type ProxyYockdClient
- func (c *ProxyYockdClient) Call(node, method string, args ...string) (string, error)
- func (c *ProxyYockdClient) Close()
- func (c *ProxyYockdClient) Dial(form, to *pb.NodeInfo) error
- func (c *ProxyYockdClient) Download(file string) error
- func (c *ProxyYockdClient) FileSystemGet(src, dst string) error
- func (c *ProxyYockdClient) FileSystemPut(src, dst string) error
- func (c *ProxyYockdClient) Info() (string, error)
- func (c *ProxyYockdClient) IsPublic() bool
- func (c *ProxyYockdClient) MakeTunnel(name string, ctx context.Context, p yocki.Promise, e chan yocki.PromiseEvent) error
- func (c *ProxyYockdClient) Mark(name, addr string) error
- func (c *ProxyYockdClient) Name() string
- func (c *ProxyYockdClient) Ping() error
- func (c *ProxyYockdClient) ProcessFind(pid int64, cmd string) ([]*pb.Process, error)
- func (c *ProxyYockdClient) ProcessKill(pid int64) error
- func (c *ProxyYockdClient) ProcessList() ([]*pb.Process, error)
- func (c *ProxyYockdClient) ProcessSpawn(t pb.ProcessSpawnType, spec, cmd string) (int64, error)
- func (c *ProxyYockdClient) SignalClear(sigs ...string) error
- func (c *ProxyYockdClient) SignalInfo(sig string) (bool, bool, error)
- func (c *ProxyYockdClient) SignalList() ([]string, error)
- func (c *ProxyYockdClient) SignalNotify(sig string) error
- func (c *ProxyYockdClient) SignalWait(sig string) (bool, error)
- func (c *ProxyYockdClient) Status()
- type RelayProtocal
- type Stun
- type StunOption
- type StunProtocal
- type TCPClient
- type TCPListerner
- type TCPServer
- type UDPClient
- type UDPConn
- type UDPListener
- type UDPServer
- type YockdClientOption
Constants ¶
View Source
const ( Center = 0b01 Worker = 0b10 )
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...NodeOption)
func NewDirect ¶
func NewDirect(opt *YockdClientOption) yocki.YockdClient
func OptionTransportCreds ¶
func OptionTransportCreds(c, k string, cas ...string) grpc.DialOption
func ParseProto ¶
Types ¶
type DeliveryClient ¶
type DeliveryClient struct {
// contains filtered or unexported fields
}
func NewDelivery ¶
func NewDelivery(node string, promise yocki.Promise, e chan yocki.PromiseEvent) *DeliveryClient
func (*DeliveryClient) Call ¶
func (c *DeliveryClient) Call(node, method string, args ...string) (string, error)
func (*DeliveryClient) Close ¶
func (c *DeliveryClient) Close()
func (*DeliveryClient) Download ¶
func (c *DeliveryClient) Download(file string) error
func (*DeliveryClient) FileSystemGet ¶
func (c *DeliveryClient) FileSystemGet(src, dst string) error
func (*DeliveryClient) FileSystemPut ¶
func (c *DeliveryClient) FileSystemPut(src, dst string) error
func (*DeliveryClient) Info ¶
func (c *DeliveryClient) Info() (string, error)
func (DeliveryClient) IsPublic ¶
func (DeliveryClient) IsPublic() bool
func (*DeliveryClient) MakeTunnel ¶
func (c *DeliveryClient) MakeTunnel(name string, ctx context.Context, p yocki.Promise, e chan yocki.PromiseEvent) error
func (*DeliveryClient) Mark ¶
func (c *DeliveryClient) Mark(name, addr string) error
func (*DeliveryClient) Name ¶
func (c *DeliveryClient) Name() string
func (*DeliveryClient) Ping ¶
func (c *DeliveryClient) Ping() error
func (*DeliveryClient) ProcessFind ¶
func (*DeliveryClient) ProcessKill ¶
func (c *DeliveryClient) ProcessKill(pid int64) error
func (*DeliveryClient) ProcessList ¶
func (c *DeliveryClient) ProcessList() ([]*pb.Process, error)
func (*DeliveryClient) ProcessSpawn ¶
func (c *DeliveryClient) ProcessSpawn(t pb.ProcessSpawnType, spec, cmd string) (int64, error)
func (*DeliveryClient) SignalClear ¶
func (c *DeliveryClient) SignalClear(sigs ...string) error
func (*DeliveryClient) SignalInfo ¶
func (c *DeliveryClient) SignalInfo(sig string) (bool, bool, error)
func (*DeliveryClient) SignalList ¶
func (c *DeliveryClient) SignalList() ([]string, error)
func (*DeliveryClient) SignalNotify ¶
func (c *DeliveryClient) SignalNotify(sig string) error
func (*DeliveryClient) SignalWait ¶
func (c *DeliveryClient) SignalWait(sig string) (bool, error)
func (*DeliveryClient) Status ¶
func (c *DeliveryClient) Status()
type DirectClient ¶
type DirectClient struct {
// contains filtered or unexported fields
}
func (*DirectClient) Call ¶
func (c *DirectClient) Call(node, method string, args ...string) (string, error)
func (*DirectClient) Close ¶
func (client *DirectClient) Close()
func (*DirectClient) FileSystemDownload ¶
func (c *DirectClient) FileSystemDownload(file string) error
Download file in other peer
func (*DirectClient) FileSystemGet ¶
func (c *DirectClient) FileSystemGet(src, dst string) error
func (*DirectClient) FileSystemPut ¶
func (c *DirectClient) FileSystemPut(src, dst string) error
func (*DirectClient) Info ¶
func (c *DirectClient) Info() (string, error)
Info can obtain the meta information of the target node, including CPU, DISK, MEM and so on. You can specify it by InfoRequest, and by default only basic parameters (the name of the node, the file uploaded, and the connection information) are returned.
func (*DirectClient) IsPublic ¶
func (c *DirectClient) IsPublic() bool
func (*DirectClient) MakeTunnel ¶
func (c *DirectClient) MakeTunnel(name string, ctx context.Context, promise yocki.Promise, event chan yocki.PromiseEvent) error
func (*DirectClient) Mark ¶
func (c *DirectClient) Mark(name, addr string) error
func (*DirectClient) Name ¶
func (client *DirectClient) Name() string
func (*DirectClient) Ping ¶
func (c *DirectClient) Ping() error
Ping is used to detect whether the connection is available
func (*DirectClient) ProcessFind ¶
func (*DirectClient) ProcessKill ¶
func (c *DirectClient) ProcessKill(pid int64) error
func (*DirectClient) ProcessList ¶
func (c *DirectClient) ProcessList() ([]*pb.Process, error)
func (*DirectClient) ProcessSpawn ¶
func (c *DirectClient) ProcessSpawn(t pb.ProcessSpawnType, spec, cmd string) (int64, error)
func (*DirectClient) Register ¶
func (c *DirectClient) Register(addrs ...string) ([]string, error)
Register tells the daemon the address of the peer.
func (*DirectClient) SignalClear ¶
func (c *DirectClient) SignalClear(sigs ...string) error
func (*DirectClient) SignalInfo ¶
func (c *DirectClient) SignalInfo(sig string) (bool, bool, error)
func (*DirectClient) SignalList ¶
func (c *DirectClient) SignalList() ([]string, error)
func (*DirectClient) SignalNotify ¶
func (c *DirectClient) SignalNotify(sig string) error
Notify pushes signal to Daemon
func (*DirectClient) SignalWait ¶
func (c *DirectClient) SignalWait(sig string) (bool, error)
Wait is used to request signal from the daemon
func (*DirectClient) Status ¶
func (client *DirectClient) Status()
func (*DirectClient) Unregister ¶
func (c *DirectClient) Unregister(addrs ...string) error
Unregister tells the daemon to remove the peer according to addrs.
func (*DirectClient) Upload ¶
func (c *DirectClient) Upload(file string) error
Upload pushes file information to peers so that peers can download files
type EstablishProtocal ¶
func (EstablishProtocal) String ¶
func (p EstablishProtocal) String() string
func (EstablishProtocal) Type ¶
func (p EstablishProtocal) Type() pb.ProtocalType
type MethodCallProtocal ¶
func (MethodCallProtocal) String ¶
func (p MethodCallProtocal) String() string
func (MethodCallProtocal) Type ¶
func (MethodCallProtocal) Type() pb.ProtocalType
type NetAddr ¶
func TCPAddr2NetAddr ¶
func UDPAddr2NetAddr ¶
func (*NetAddr) LocalV4TCPAddr ¶
func (*NetAddr) LocalV4UDPAddr ¶
type NetworkManager ¶
type NetworkManager struct {
// contains filtered or unexported fields
}
func NewNetworkManager ¶
func NewNetworkManager() *NetworkManager
func (*NetworkManager) MakeBridge ¶
func (m *NetworkManager) MakeBridge()
func (*NetworkManager) Node ¶
func (m *NetworkManager) Node(name string) Node
func (*NetworkManager) Nodes ¶
func (m *NetworkManager) Nodes() map[string]Node
func (*NetworkManager) SetNode ¶
func (m *NetworkManager) SetNode(name string, node Node)
type Node ¶
type Node yocki.YockdClient
type NodeOption ¶
type NodeOption func()
type P2PProtocal ¶
type P2PProtocal interface { Protocal ParseP2P(message string) P2PProtocal Peer() []*NetAddr }
type PeerAddr ¶
type PeerAddr struct { NetAddr Peer []string Attr uint8 ID string Protocal P2PProtocal // contains filtered or unexported fields }
func (*PeerAddr) CanMakeHole ¶
type ProxyYockdClient ¶
func (*ProxyYockdClient) Call ¶
func (c *ProxyYockdClient) Call(node, method string, args ...string) (string, error)
func (*ProxyYockdClient) Close ¶
func (c *ProxyYockdClient) Close()
func (*ProxyYockdClient) Download ¶
func (c *ProxyYockdClient) Download(file string) error
func (*ProxyYockdClient) FileSystemGet ¶
func (c *ProxyYockdClient) FileSystemGet(src, dst string) error
func (*ProxyYockdClient) FileSystemPut ¶
func (c *ProxyYockdClient) FileSystemPut(src, dst string) error
func (*ProxyYockdClient) Info ¶
func (c *ProxyYockdClient) Info() (string, error)
func (*ProxyYockdClient) IsPublic ¶
func (c *ProxyYockdClient) IsPublic() bool
func (*ProxyYockdClient) MakeTunnel ¶
func (c *ProxyYockdClient) MakeTunnel(name string, ctx context.Context, p yocki.Promise, e chan yocki.PromiseEvent) error
func (*ProxyYockdClient) Mark ¶
func (c *ProxyYockdClient) Mark(name, addr string) error
func (*ProxyYockdClient) Name ¶
func (c *ProxyYockdClient) Name() string
func (*ProxyYockdClient) Ping ¶
func (c *ProxyYockdClient) Ping() error
func (*ProxyYockdClient) ProcessFind ¶
func (*ProxyYockdClient) ProcessKill ¶
func (c *ProxyYockdClient) ProcessKill(pid int64) error
func (*ProxyYockdClient) ProcessList ¶
func (c *ProxyYockdClient) ProcessList() ([]*pb.Process, error)
func (*ProxyYockdClient) ProcessSpawn ¶
func (c *ProxyYockdClient) ProcessSpawn(t pb.ProcessSpawnType, spec, cmd string) (int64, error)
func (*ProxyYockdClient) SignalClear ¶
func (c *ProxyYockdClient) SignalClear(sigs ...string) error
func (*ProxyYockdClient) SignalInfo ¶
func (c *ProxyYockdClient) SignalInfo(sig string) (bool, bool, error)
func (*ProxyYockdClient) SignalList ¶
func (c *ProxyYockdClient) SignalList() ([]string, error)
func (*ProxyYockdClient) SignalNotify ¶
func (c *ProxyYockdClient) SignalNotify(sig string) error
func (*ProxyYockdClient) SignalWait ¶
func (c *ProxyYockdClient) SignalWait(sig string) (bool, error)
func (*ProxyYockdClient) Status ¶
func (c *ProxyYockdClient) Status()
type RelayProtocal ¶
type RelayProtocal interface { Type() pb.ProtocalType String() string }
type Stun ¶
type Stun struct {
// contains filtered or unexported fields
}
func NewStun ¶
func NewStun(opts ...StunOption) *Stun
func (*Stun) ReadFromClient ¶
func (*Stun) ReadFromServer ¶
func (s *Stun) ReadFromServer()
func (*Stun) WriteToClient ¶
func (s *Stun) WriteToClient()
func (*Stun) WriteToServer ¶
func (s *Stun) WriteToServer()
type StunOption ¶
func OptionEnableStunClient ¶
func OptionEnableStunClient(laddr, raddr *NetAddr) StunOption
func OptionEnableStunServer ¶
func OptionEnableStunServer(addr *NetAddr) StunOption
func OptionSetToken ¶
func OptionSetToken(token string) StunOption
type StunProtocal ¶
type StunProtocal struct { Hash string `json:"hash"` Ver uint32 `json:"version"` Peers []*PeerAddr `json:"peer"` ID string `json:"id"` }
func (*StunProtocal) Bytes ¶
func (p *StunProtocal) Bytes() []byte
func (*StunProtocal) Parse ¶
func (p *StunProtocal) Parse(message []byte) Protocal
func (*StunProtocal) Version ¶
func (p *StunProtocal) Version() string
type TCPListerner ¶
type TCPListerner struct {
// contains filtered or unexported fields
}
func NewTCPListerner ¶
func NewTCPListerner(addr *NetAddr) *TCPListerner
func (*TCPListerner) Accept ¶
func (listen *TCPListerner) Accept()
func (*TCPListerner) Dial ¶
func (listen *TCPListerner) Dial(addr *NetAddr)
type UDPListener ¶
type UDPListener struct {
// contains filtered or unexported fields
}
func NewUDPListener ¶
func NewUDPListener(addr *NetAddr) *UDPListener
func (*UDPListener) Dial ¶
func (listen *UDPListener) Dial(addr *NetAddr)
func (*UDPListener) Read ¶
func (listen *UDPListener) Read()
func (*UDPListener) Write ¶
func (listen *UDPListener) Write()
Click to show internal directories.
Click to hide internal directories.