@@ -648,6 +648,47 @@ paths:
648648 500 :
649649 $ref : " #/responses/500ErrorResponse"
650650
651+ /peer/heartbeat :
652+ get :
653+ summary : " report the heart beat to super node."
654+ description : |
655+ This endpoint is mainly for reporting the heart beat to supernode.
656+ And supernode could know if peer is alive in strem mode.
657+ parameters :
658+ - name : " body"
659+ in : " body"
660+ description : " request body which contains peer info."
661+ schema :
662+ $ref : " #/definitions/HeartBeatRequest"
663+ responses :
664+ 200 :
665+ description : " no error"
666+ schema :
667+ $ref : " #/definitions/ResultInfo"
668+ 500 :
669+ $ref : " #/responses/500ErrorResponse"
670+
671+ /peer/network :
672+ get :
673+ summary : " peer request the p2p network info from supernode."
674+ description : |
675+ In the new mode which dfdaemon will provide the seed file so that other peers
676+ could download. This endpoint is mainly for fetching the p2p network info.
677+ parameters :
678+ - name : " body"
679+ in : " body"
680+ description : " request body which filter urls."
681+ schema :
682+ $ref : " #/definitions/NetworkInfoFetchRequest"
683+ responses :
684+ 200 :
685+ description : " no error"
686+ schema :
687+ $ref : " #/definitions/NetworkInfoFetchResponse"
688+ 500 :
689+ $ref : " #/responses/500ErrorResponse"
690+
691+
651692definitions :
652693 Error :
653694 type : " object"
@@ -793,6 +834,22 @@ definitions:
793834 this field to supernode and supernode can do some checking and filtering via
794835 black/white list mechanism to guarantee security, or some other purposes like debugging.
795836 minLength : 1
837+ taskId :
838+ type : " string"
839+ description : |
840+ Dfdaemon or dfget could specific the taskID which will represents the key of this resource
841+ in supernode.
842+ fileLength :
843+ type : " integer"
844+ description : |
845+ This attribute represents the length of resource, dfdaemon or dfget catches and calculates
846+ this parameter from the headers of request URL. If fileLength is vaild, the supernode need
847+ not get the length of resource by accessing the rawURL.
848+ format : " int64"
849+ asSeed :
850+ type : " boolean"
851+ description : |
852+ This attribute represents the node as a seed node for the taskURL.
796853
797854 PeerCreateRequest :
798855 type : " object"
@@ -945,6 +1002,18 @@ definitions:
9451002 downloads, if there is already a task a.b.com/fileA.
9461003 items :
9471004 type : " string"
1005+ taskId :
1006+ type : " string"
1007+ description : |
1008+ This attribute represents the digest of resource, dfdaemon or dfget catches this parameter
1009+ from the headers of request URL. The digest will be considered as the taskID if not null.
1010+ fileLength :
1011+ type : " integer"
1012+ description : |
1013+ This attribute represents the length of resource, dfdaemon or dfget catches and calculates
1014+ this parameter from the headers of request URL. If fileLength is vaild, the supernode need
1015+ not get the length of resource by accessing the rawURL.
1016+ format : " int64"
9481017 peerID :
9491018 type : " string"
9501019 description : |
@@ -1055,6 +1124,10 @@ definitions:
10551124 from source server as user's wish.
10561125 additionalProperties :
10571126 type : " string"
1127+ asSeed :
1128+ type : " boolean"
1129+ description : |
1130+ This attribute represents the node as a seed node for the taskURL.
10581131
10591132 TaskUpdateRequest :
10601133 type : " object"
@@ -1362,6 +1435,82 @@ definitions:
13621435 format : " int64"
13631436 description : " The length of the file dfget requests to download in bytes."
13641437
1438+ NetworkInfoFetchRequest :
1439+ type : " object"
1440+ description : " The request is to fetch p2p network info from supernode."
1441+ properties :
1442+ urls :
1443+ type : " array"
1444+ description : |
1445+ The urls is to filter the peer node, the url should be match with taskURL in TaskInfo.
1446+ items :
1447+ type : " string"
1448+
1449+ TaskFetchInfo :
1450+ type : " object"
1451+ description : " It shows the task info and pieces info."
1452+ properties :
1453+ task :
1454+ $ref : " #/definitions/TaskInfo"
1455+ pieces :
1456+ type : " array"
1457+ description : " The pieces which should belong to the peer node"
1458+ items :
1459+ $ref : " #/definitions/PieceInfo"
1460+
1461+ Node :
1462+ type : " object"
1463+ description : " The object shows the basic info of node and the task belongs to the node."
1464+ properties :
1465+ basic :
1466+ $ref : " #/definitions/PeerInfo"
1467+ description : " Basic node info"
1468+ extra :
1469+ type : " object"
1470+ additionalProperties :
1471+ type : " string"
1472+ load :
1473+ type : " integer"
1474+ description : " The load of node, which as the schedule weight in peer schedule."
1475+ tasks :
1476+ type : " array"
1477+ items :
1478+ $ref : " #/definitions/TaskFetchInfo"
1479+
1480+ NetworkInfoFetchResponse :
1481+ type : " object"
1482+ description : " The response is from supernode to peer which is requested to fetch p2p network info."
1483+ properties :
1484+ nodes :
1485+ type : " array"
1486+ items :
1487+ $ref : " #/definitions/Node"
1488+
1489+ HeartBeatRequest :
1490+ type : " object"
1491+ description : " The request is to report the heart beat to super node."
1492+ properties :
1493+ IP :
1494+ type : " string"
1495+ description : " IP address which peer client carries."
1496+ format : " ipv4"
1497+ port :
1498+ type : " integer"
1499+ description : |
1500+ when registering, dfget will setup one uploader process.
1501+ This one acts as a server for peer pulling tasks.
1502+ This port is which this server listens on.
1503+ format : " int32"
1504+ minimum : 15000
1505+ maximum : 65000
1506+ cID :
1507+ type : " string"
1508+ description : |
1509+ CID means the client ID. It maps to the specific dfget process.
1510+ When user wishes to download an image/file, user would start a dfget process to do this.
1511+ This dfget is treated a client and carries a client ID.
1512+ Thus, multiple dfget processes on the same peer have different CIDs.
1513+
13651514 ErrorResponse :
13661515 type : " object"
13671516 description : |
0 commit comments