Skip to content

Commit

Permalink
chore: test sequantial download
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelTaylor3D committed Sep 20, 2024
1 parent 1702341 commit ac519b4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/DigNetwork/ContentServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class ContentServer {
// Method to get the content of a specified key from the peer, with optional challenge query
public async getKey(key: string, rootHash: string, challengeHex?: string): Promise<string> {
// Construct the base URL
let url = `http://${this.ipAddress}/chia.${this.storeId}.${rootHash}/${key}`;
let url = `http://${this.ipAddress}:${ContentServer.port}/chia.${this.storeId}.${rootHash}/${key}`;

// If a challenge is provided, append it as a query parameter
if (challengeHex) {
Expand All @@ -52,33 +52,33 @@ export class ContentServer {

// Method to get the .well-known information
public async getWellKnown(): Promise<any> {
const url = `http://${this.ipAddress}/.well-known`;
const url = `http://${this.ipAddress}:${ContentServer.port}/.well-known`;
return this.fetchJson(url);
}

// Method to get the list of known stores
public async getKnownStores(): Promise<any> {
const url = `http://${this.ipAddress}/.well-known/stores`;
const url = `http://${this.ipAddress}:${ContentServer.port}/.well-known/stores`;
return this.fetchJson(url);
}

// Method to get the index of all stores
public async getStoresIndex(): Promise<any> {
const url = `http://${this.ipAddress}/`;
const url = `http://${this.ipAddress}:${ContentServer.port}/`;
return this.fetchJson(url);
}

// Method to get the index of keys in a store
public async getKeysIndex(): Promise<any> {
const url = `http://${this.ipAddress}/${this.storeId}`;
const url = `http://${this.ipAddress}:${ContentServer.port}/${this.storeId}`;
return this.fetchJson(url);
}

// Method to check if a specific key exists (HEAD request)
public async headKey(
key: string
): Promise<{ success: boolean; headers?: http.IncomingHttpHeaders }> {
const url = `http://${this.ipAddress}/${this.storeId}/${key}`;
const url = `http://${this.ipAddress}:${ContentServer.port}/${this.storeId}/${key}`;
return this.head(url);
}

Expand All @@ -87,7 +87,7 @@ export class ContentServer {
success: boolean;
headers?: http.IncomingHttpHeaders;
}> {
let url = `http://${this.ipAddress}/${this.storeId}`;
let url = `http://${this.ipAddress}:${ContentServer.port}/${this.storeId}`;

if (options?.hasRootHash) {
url += `?hasRootHash=${options.hasRootHash}`;
Expand All @@ -98,7 +98,7 @@ export class ContentServer {

public streamKey(key: string): Promise<Readable> {
return new Promise((resolve, reject) => {
const url = `http://${this.ipAddress}/${this.storeId}/${key}`;
const url = `http://${this.ipAddress}:${ContentServer.port}/${this.storeId}/${key}`;
const urlObj = new URL(url);

const requestOptions = {
Expand Down
2 changes: 1 addition & 1 deletion src/DigNetwork/DigNetwork.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class DigNetwork {

const peerIp = digPeers[0];
const digPeer = new DigPeer(peerIp, storeId);
const storeResponse = await digPeer.contentServer.headStore({
const storeResponse = await digPeer.propagationServer.headStore({
hasRootHash: rootHash,
});

Expand Down

0 comments on commit ac519b4

Please sign in to comment.