Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
NotSupportedConnection = errors.New("Not Supported Connection")
)
Functions ¶
This section is empty.
Types ¶
type DBConnection ¶
type DBConnection interface { // Signals that there are changes to the Database since the last FetchOps // Should not be called while on the Trigger() error // request that all changes since the given UUID of a command are send using the given FetchOpsMethod. // // You can not get or make more then one simultanious FetchOps. // // "" means all changes otherwise it is a uuid of previously transfered command. Look at the protocol specification for which command's uuids can be used. FetchOps(FetchOpsMethod, string) error // Close the underlying connection. Close() error }
type DummyFetchOps ¶
type DummyFetchOps struct {
// contains filtered or unexported fields
}
func (*DummyFetchOps) Close ¶
func (d *DummyFetchOps) Close() (err error)
func (*DummyFetchOps) SendCommand ¶
func (d *DummyFetchOps) SendCommand(command msg.Command) (err error)
type Gomahawk ¶
type Gomahawk interface { // Human readable Name Name() string // A new connection from the given address is requested. // If the returned value is true GomahawkServer will continue // with the connection otherwise the connection will be closed. ConnectionIsRequested(net.Addr) bool // Found peer at the given address. // Name could be empty. // If the returned value is true GomahawkServer will try to connect to it. NewTomahawkFound(addr net.Addr, name string) bool // The given Tomahawk made DBConnection (by our request). // NewDBConnection(Tomahawk, DBConnection) (DBConnection, error) // The given Tomahawk has requested a DBConnection. // If the returned DBConneciton is nil the request will be denied. NewDBConnectionRequested(Tomahawk, DBConnection) (DBConnection, error) // The given Tomahawk has requested a StreamConnection for file with the given id // if the returned connection isn't nil it will be used to stream the file NewStreamConnectionRequested(t Tomahawk, uuid string) (StreamConnection, error) }
type GomahawkServer ¶
type GomahawkServer interface { // Listen to the given port and ip. The default port is 50210 // error is being returned if that is not possible ListenTo(ip net.IP, port int) error // start the listening and advertising Start() error // says to advertise this instance // (this is regardless of advertisement period set by AdvertEvery) Advertise() error // Sets a period of time that the advert will be sent. // // By default 0 which means never AdvertiseEvery(seconds int) // retuns the name. This is the same as the Gomahawk.Name() for the Gomahawk instance // given to GomahawkServer Name() string // returns the currently connected tomahawks GetTomahawks() []Tomahawk }
GomahawkServer
func NewGomahawkServer ¶
func NewGomahawkServer(gomahawk Gomahawk) (result GomahawkServer, err error)
returns new instance of Gomahawk
type StreamConnection ¶
type StreamConnection interface { // returns the ID of the file associated with this connection FileID() int64 // return the current stream. Multiple calls to this function without SeekToBlock // return the same channel GetStream() (<-chan []byte, error) // this will close the previos stream and make a new one that will start giving blocks from the given index forward // the size of block is not set but it should be considered constant for each StreamConnection // // The original Tomahawk has it hardcoded to 4096 bytes at the time of writing SeekToBlock(blockIndex int) error }
The StreamConnection is used to transfer files over the network
type Tomahawk ¶
type Tomahawk interface { // Returns a human readable name of the instance. Can be empty string Name() string // Returns the uuid of the tomahawk instance as a string. // // While implementing this interface you can use "" and a uuid based on the name UUID() string // Get a streamConnection for the file with the given id previously received from AddFiles command from this tomahawk. // // NotSupportedConnection is returned when this type of connection is not supported // Others error mean that the connection was not successfully created RequestStreamConnection(uuid int64) (StreamConnection, error) // A non blocking request for a DBConnection // a call to NewDBConnection with the associated Tomahawk and the DBConnection will be made // when and if the remote tomahawks agrees to it. // Multiple calls to this // // NotSupportedConnection is returned when this type of connection is not supported // Others error mean that the connection was not successfully created RequestDBConnection(DBConnection) error // The last time a ping message was received from this particular Tomahawk LastPing() time.Time }
This is the Interface that represents a remote Tomahawk.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.