GWebCache 1.0.0-alpha
C# library and nuget package to interact with a Gnutella Webcache
Loading...
Searching...
No Matches
GWebCache.IGWebCacheClient Interface Reference

Client for interacting with a GWebCache server. Supports Version 1 and 2 of the protocol. More...

Inheritance diagram for GWebCache.IGWebCacheClient:
GWebCache.GWebCacheClient

Public Member Functions

bool CheckIfAlive ()
 Preforms a ping request to the server to check if it is alive.
 
bool WebCacheIsV2 ()
 Returns the property GWebCacheClientConfig.IsV2
 
Result< PongResponsePing ()
 Preforms a ping request to the webcache. Mainly used to check if the server is alive.
 
Result< StatFileResponseGetStats ()
 Returns the stats of the webcache server.
 
Result< HostfileResponseGetHostfile (GnutellaNetwork? network=null)
 Retrieves a list of Gnutella Nodes from the webcache.
 
Result< UrlFileResponseGetUrlFile (GnutellaNetwork? network=null)
 Retrieves a list of Urls to other webcaches from the webcache.
 
Result< GetResponseGet (GnutellaNetwork? network)
 Retrieves a list of Gnutella Nodes and webcache urls from a V2 webache. This is only valid on a V2 cache!
 
Result< UpdateResponseUpdate (UpdateRequest updateRequest)
 Sends an Update request to the webcache. Indicating a new gnutella node, or webcache url or both.
 

Detailed Description

Client for interacting with a GWebCache server. Supports Version 1 and 2 of the protocol.

Member Function Documentation

◆ CheckIfAlive()

bool GWebCache.IGWebCacheClient.CheckIfAlive ( )

Preforms a ping request to the server to check if it is alive.

Returns
Boolean indicating if the server succesfully anwsered the ping request

A succesfull pong response is defined in PongResponse

Ping

See also
PongResponse

Implemented in GWebCache.GWebCacheClient.

◆ Get()

Result< GetResponse > GWebCache.IGWebCacheClient.Get ( GnutellaNetwork? network)

Retrieves a list of Gnutella Nodes and webcache urls from a V2 webache. This is only valid on a V2 cache!

Parameters
networkThe network you want to get the nodes and webcache urls from.
Returns
A Result with GetResponse

GetResponse

See also
Result<T>, GnutellaNetwork, GWebCacheNode

Implemented in GWebCache.GWebCacheClient.

◆ GetHostfile()

Result< HostfileResponse > GWebCache.IGWebCacheClient.GetHostfile ( GnutellaNetwork? network = null)

Retrieves a list of Gnutella Nodes from the webcache.

Parameters
networkThe network you want to get the nodes from. Will not be specified by default.
Returns
A Result with HostFileResponse

V1 caches typically don't include gnutella 2 or the network parameter. However they will ignore it so it's always best to specify.

You can use this method on both versions. It is however recommended to use the Get(GnutellaNetwork?) method for version 2 of the specification.

<example

IGWebCacheClient client = new GWebCacheClient("url");
client.GetHostfile(GnutellaNetwork.Gnutella2);
Concrete implementation of IGWebCacheClient
Definition GWebCacheClient.cs:14
Client for interacting with a GWebCache server. Supports Version 1 and 2 of the protocol.
Definition IGWebCacheClient.cs:12
Result< HostfileResponse > GetHostfile(GnutellaNetwork? network=null)
Retrieves a list of Gnutella Nodes from the webcache.
GnutellaNetwork
There's two versions of Gnutella V1 and V2 some methods require you to specify which version is used....
Definition GnutellaNetwork.cs:6

Result<T>

See also
HostfileResponse, GnutellaNetwork, Get(GnutellaNetwork?), GnutellaNode

Implemented in GWebCache.GWebCacheClient.

◆ GetStats()

Result< StatFileResponse > GWebCache.IGWebCacheClient.GetStats ( )

Returns the stats of the webcache server.

Returns
A Result with StatFileResponse

Not all webcache servers actually implement this. So don't assume you will get a successfull result.

Result<T>

See also
StatFileResponse

Implemented in GWebCache.GWebCacheClient.

◆ GetUrlFile()

Result< UrlFileResponse > GWebCache.IGWebCacheClient.GetUrlFile ( GnutellaNetwork? network = null)

Retrieves a list of Urls to other webcaches from the webcache.

Parameters
networkThe network you want to get the nodes from. Will not be specified by default.
Returns
A Result with UrlFileResponse

While the network parameter doesn't make a difference in V2 caches a lot of them require it and will return the same result regardless.

IGWebCacheClient client = new GWebCacheClient("url");
client.GetUrlFile(GnutellaNetwork.Gnutella2);
Result< UrlFileResponse > GetUrlFile(GnutellaNetwork? network=null)
Retrieves a list of Urls to other webcaches from the webcache.

UrlFileResponse

See also
Result<T>, GnutellaNetwork, GWebCacheNode

Implemented in GWebCache.GWebCacheClient.

◆ Ping()

Result< PongResponse > GWebCache.IGWebCacheClient.Ping ( )

Preforms a ping request to the webcache. Mainly used to check if the server is alive.

Returns
A Result with Pongresponse

Result<T>

See also
PongResponse

Implemented in GWebCache.GWebCacheClient.

◆ Update()

Result< UpdateResponse > GWebCache.IGWebCacheClient.Update ( UpdateRequest updateRequest)

Sends an Update request to the webcache. Indicating a new gnutella node, or webcache url or both.

Returns
A Result with UpdateResponse

Note that there's a network parameter in the update request.

The update response might also contain warnings when for example you're being rate limited.

IGWebCacheClient client = new GWebCacheClient("V2 url");
GnutellaNode node = GnutellaNode("ip", port);
GWebCacheNode webCache = new GWebCacheNode("url");
UpdateRequest updateRequest = new UpdateRequest() {
GnutellaNode = node,
GWebCacheNode = webCache,
Network = GnutellaNetwork.Gnutella2
};
client.Update(updateRequest);
A model representing a webcache.
Definition GWebCacheNode.cs:7
The model representing a Gnutella node on the network stored in the cache.
Definition GnutellaNode.cs:9
Request model to update the webcache with a new gnutella node or a WebCache Url.
Definition UpdateRequest.cs:11
Result< UpdateResponse > Update(UpdateRequest updateRequest)
Sends an Update request to the webcache. Indicating a new gnutella node, or webcache url or both.

UpdateResponse" <seealso cref="Result{T}"/> <seealso cref="UpdateRequest"/> <seealso cref="GnutellaNode"/> <seealso cref="GWebCacheNode"/>

Implemented in GWebCache.GWebCacheClient.

◆ WebCacheIsV2()

bool GWebCache.IGWebCacheClient.WebCacheIsV2 ( )

Returns the property GWebCacheClientConfig.IsV2

If this property wasn't specified, a ping request is made when creating the client to fill in this property.

GWebCacheClientConfig.IsV2

See also
Ping

Implemented in GWebCache.GWebCacheClient.


The documentation for this interface was generated from the following file: