diff --git a/FAQ.md b/FAQ.md index 83ba00280..6c521d33f 100644 --- a/FAQ.md +++ b/FAQ.md @@ -298,7 +298,7 @@ Name | Flag | Remark ------------------------------ | ------------------------- | ---------- dfdaemon proxy server port | dfdaemon --port | The port should be in the range of 2000-65535. dfget uploader server port | dfget server --port | You can use command `dfget server` to start a uploader server before using dfget to download if you don't want to use a random port. -supernode register port | supernode --port | You can use `dfget --node IP:port` to register with the specified supernode register port. +supernode register port | supernode --port | You can use `dfget --node host:port` to register with the specified supernode register port. supernode cdn file server port | supernode --download-port | You should prepare a file server firstly and listen on the port that flag `download-port` will use. **NOTE**: The supernode maintains both Java and Golang versions currently. And the above table is for the Golang version. And you will get a guide [here](https://d7y.io/en-us/docs/userguide/supernode_configuration.html) for Java version. diff --git a/apis/swagger.yml b/apis/swagger.yml index c18719d1f..3b1548bb3 100644 --- a/apis/swagger.yml +++ b/apis/swagger.yml @@ -642,8 +642,7 @@ definitions: format: "ipv4" superNodeIp: type: "string" - description: "IP address of supernode that the client can connect to" - format: "ipv4" + description: "The address of supernode that the client can connect to" hostName: type: "string" description: "host name of peer client node." diff --git a/apis/types/task_register_request.go b/apis/types/task_register_request.go index 90886382f..4b20c61d1 100644 --- a/apis/types/task_register_request.go +++ b/apis/types/task_register_request.go @@ -86,9 +86,8 @@ type TaskRegisterRequest struct { // RawURL string `json:"rawURL,omitempty"` - // IP address of supernode that the client can connect to - // Format: ipv4 - SuperNodeIP strfmt.IPv4 `json:"superNodeIp,omitempty"` + // The address of supernode that the client can connect to + SuperNodeIP string `json:"superNodeIp,omitempty"` // taskURL is generated from rawURL. rawURL may contains some queries or parameter, dfget will filter some queries via // --filter parameter of dfget. The usage of it is that different rawURL may generate the same taskID. @@ -119,10 +118,6 @@ func (m *TaskRegisterRequest) Validate(formats strfmt.Registry) error { res = append(res, err) } - if err := m.validateSuperNodeIP(formats); err != nil { - res = append(res, err) - } - if len(res) > 0 { return errors.CompositeValidationError(res...) } @@ -185,19 +180,6 @@ func (m *TaskRegisterRequest) validatePort(formats strfmt.Registry) error { return nil } -func (m *TaskRegisterRequest) validateSuperNodeIP(formats strfmt.Registry) error { - - if swag.IsZero(m.SuperNodeIP) { // not required - return nil - } - - if err := validate.FormatOf("superNodeIp", "body", "ipv4", m.SuperNodeIP.String(), formats); err != nil { - return err - } - - return nil -} - // MarshalBinary interface implementation func (m *TaskRegisterRequest) MarshalBinary() ([]byte, error) { if m == nil { diff --git a/cmd/dfdaemon/app/root.go b/cmd/dfdaemon/app/root.go index bf450ff6c..c344bbe80 100644 --- a/cmd/dfdaemon/app/root.go +++ b/cmd/dfdaemon/app/root.go @@ -96,7 +96,7 @@ func init() { rf.String("ratelimit", util.NetLimit(), "net speed limit,format:xxxM/K") rf.String("urlfilter", "Signature&Expires&OSSAccessKeyId", "filter specified url fields") rf.Bool("notbs", true, "not try back source to download if throw exception") - rf.StringSlice("node", nil, "specify the addresses(IP:port) of supernodes that will be passed to dfget.") + rf.StringSlice("node", nil, "specify the addresses(host:port) of supernodes that will be passed to dfget.") exitOnError(bindRootFlags(viper.GetViper()), "bind root command flags") } diff --git a/cmd/dfget/app/root.go b/cmd/dfget/app/root.go index 18e6eac95..ce95d0b7e 100644 --- a/cmd/dfget/app/root.go +++ b/cmd/dfget/app/root.go @@ -224,7 +224,7 @@ func initFlags() { flagSet.StringSliceVar(&cfg.Header, "header", nil, "http header, eg: --header='Accept: *' --header='Host: abc'") flagSet.StringSliceVarP(&cfg.Node, "node", "n", nil, - "specify the addresses(IP:port) of supernodes") + "specify the addresses(host:port) of supernodes") flagSet.BoolVar(&cfg.Notbs, "notbs", false, "disable back source downloading for requested file when p2p fails to download it") flagSet.BoolVar(&cfg.DFDaemon, "dfdaemon", false, diff --git a/hack/build.sh b/hack/build.sh index fe73510fe..f9d9b12f1 100755 --- a/hack/build.sh +++ b/hack/build.sh @@ -87,7 +87,7 @@ main() { if [[ "1" == "${USE_DOCKER}" ]] then echo "Begin to build with docker." - case "$1" in + case "${1-}" in dfdaemon) build-dfdaemon-docker ;; diff --git a/hack/install.sh b/hack/install.sh index c42666fd4..879401615 100755 --- a/hack/install.sh +++ b/hack/install.sh @@ -15,7 +15,7 @@ cd "${curDir}" || return . ./env.sh install() { - case "$1" in + case "${1-}" in dfclient) install-client ;; @@ -53,7 +53,7 @@ install-supernode(){ uninstall() { - case "$1" in + case "${1-}" in dfclient) uninstall-client ;; @@ -101,12 +101,12 @@ createDir() { } main() { - case "$1" in + case "${1-}" in install) - install "$2" + install "${2-}" ;; uninstall) - uninstall "$2" + uninstall "${2-}" ;; *) echo "You must specify the subcommand 'install' or 'uninstall'." diff --git a/hack/package.sh b/hack/package.sh index a29e2eea5..d0ecb6b83 100755 --- a/hack/package.sh +++ b/hack/package.sh @@ -33,7 +33,7 @@ main() { FPM="fpm" fi - case "$1" in + case "${1-}" in rpm ) build_rpm ;; diff --git a/supernode/server/0.3_bridge.go b/supernode/server/0.3_bridge.go index 919f6c009..a99556631 100644 --- a/supernode/server/0.3_bridge.go +++ b/supernode/server/0.3_bridge.go @@ -86,7 +86,7 @@ func (s *Server) registry(ctx context.Context, rw http.ResponseWriter, req *http PeerID: peerID, RawURL: request.RawURL, TaskURL: request.TaskURL, - SupernodeIP: request.SuperNodeIP.String(), + SupernodeIP: request.SuperNodeIP, } resp, err := s.TaskMgr.Register(ctx, taskCreateRequest) if err != nil {