-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14cfb94
commit 37b8990
Showing
30 changed files
with
193 additions
and
28 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package client | ||
|
||
import "github.com/peakedshout/go-CFC/tool" | ||
|
||
type SubType string | ||
|
||
const ( | ||
SubTypeUP2P = SubType("SubTypeUP2P") | ||
SubTypeP2P = SubType("SubTypeP2P") | ||
SubTypeProxy = SubType("SubTypeProxy") | ||
) | ||
|
||
func (st *SubType) String() string { | ||
return string(*st) | ||
} | ||
|
||
func (box *DeviceBox) GetSubBoxBySubType(name string, subType SubType) (*SubBox, error) { | ||
switch subType { | ||
case SubTypeProxy: | ||
return box.GetSubBox(name) | ||
case SubTypeP2P: | ||
return box.GetSubBoxByP2P(name) | ||
case SubTypeUP2P: | ||
return box.GetSubBoxByUP2P(name) | ||
default: | ||
return nil, tool.ErrSubTypeInvalid | ||
} | ||
} | ||
|
||
func (box *DeviceBox) GetSubBoxBySubTypeMix(name string, subTypes []SubType) (*SubBox, []error, error) { | ||
errs := make([]error, len(subTypes)) | ||
for i, one := range subTypes { | ||
sub, err := box.GetSubBoxBySubType(name, one) | ||
if err != nil { | ||
errs[i] = err | ||
continue | ||
} | ||
return sub, errs, nil | ||
} | ||
return nil, errs, tool.ErrSubTypeToMixGetSubBoxFailed | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.