-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implemented experimental ptp(corenet) interface #3943
Conversation
283965d
to
672f69d
Compare
core/commands/corenet.go
Outdated
|
||
var CorenetCmd = &cmds.Command{ | ||
Helptext: cmds.HelpText{ | ||
Tagline: "Application network streams.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets add a config option |
test/sharness/t0180-corenet.sh
Outdated
@@ -26,7 +26,16 @@ test_expect_success "test ports are closed" ' | |||
(! (netstat -ln | grep "LISTEN" | grep ":10102 ")) | |||
' | |||
|
|||
test_expect_success 'start ipfs listener' ' | |||
test_expect_success 'fail without config option being enabled' ' | |||
! ipfsi 0 exp corenet ls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use test_must_fail
instead of !
here.
795f028
to
7fcb9d0
Compare
Looking good. The one last thing to consider now is whether or not we should put it under the 'exp' subcommand, or just keep it in the normal namespace. The other experimental commands (filestore and pubsub) exist in the top level, so i'm leaning towards doing that. Also not sure on the naming of 'corenet'. What do you think @Kubuxu @lgierth @hsanjuan ? (also, @hsanjuan you might be able to rework ipfs cluster to use this feature once its merged :D ) |
I'm leaning towards having this in the top level namespace (not under an |
I still want/need to move all the registry logic to a root package, and make it have instance in node instead of 1 global now. I don't like the naming too, but after trying to come up with something short that would make sense (other than p2pnet, but I'm not sure) I decided to leave |
I am also not really attached to the name. |
24d5f04
to
42e9040
Compare
I'll look at this tomorrow -- awesome work! :) |
License: MIT Signed-off-by: Tom Swindell <[email protected]>
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
ptp/apps.go
Outdated
} | ||
|
||
// AppRegistry is a collection of local application protocol listeners. | ||
type AppRegistry struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably want to add some locking here to make it threadsafe. I can definitely see people running these commands in parallel
ptp/apps.go
Outdated
} | ||
|
||
// Deregister deregisters protocol handler from this registry | ||
func (c *AppRegistry) Deregister(proto string) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will also want to add a listing method that does proper locking
Awesome work :):) 🌴 I think the use cases here are a bit underexplained, I don't see any showstoppers with the approach taken, but I'm just not clear enough on the use cases :) Is it just a simple 1-to-1 netcat? Or 1-to-n? What is the UX for accepting more than one connection? Design questions:
I haven't thoroughly CRed the code itself yet, but I think we can keep this whole package free of dependencies on go-ipfs code. There are a few instances where you depend on |
For now it's more of a tunneling thing (like ssh port forwarding). For more than one connection I'm thinking of a dial option to make it forward more than one connection (so behave like ssh forwarding), perhaps even making it the default behavior and have option for one-time dial.
Other than that, some naming conventions are still going to change to make things more clear ( |
@lgierth identify should announce these protocols as it just grabs whatever
is registered on the host.
I think we can keep designing this as we move forward. It's clearly marked
as experimental so making api and design changes post merge is perfectly
acceptable. Once people start using it and requesting different use cases,
we will have a much better idea of what exactly is needed to generalize it
better.
…On Sat, Jun 3, 2017, 03:36 Łukasz Magiera ***@***.***> wrote:
For now it's more of a tunneling thing (like ssh port forwarding). For
more than one connection I'm thinking of a dial option to make it forward
more than one connection (so behave like ssh forwarding), perhaps even
making it the default behavior and have option for one-time dial.
- I decided to use dialers as there are no easily muxable API systems
yet (websocket/custom proto/etc.). I'm not really sure what you mean by
other stream handlers being involved, but the answer is probably no - have
you seen ptp/net/net.go?
- With this code you shouldn't be able to manage built-in stream
handlers - the ones used here are prefixed with /app/ prefix(which I
will likely change to /ptp/). For now it's only tunnels over libp2p.
- I don't really know what do you mean by Identify here.
Other than that, some naming conventions are still going to change to make
things more clear (app was left from the base PR).
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#3943 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABL4HKIUr1e62cfF4ADDYs2U6lQF4mWLks5sATcOgaJpZM4NoE8K>
.
|
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
43549df
to
712a522
Compare
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM. like i said earlier, I want to get this in so people who have cool use cases for it can start playing with it. Once we get their feedback we can refine how things work better, and also once we get websockets in the api we can use that as an option.
@lgierth @Kubuxu sound good to you? I'd love to get this into the next release quite soon
core/commands/ptp.go
Outdated
if !n.OnlineMode() { | ||
res.SetError(errNotOnline, cmds.ErrClient) | ||
return | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO I would compress code above into once function (returning node or error in case those checks fail) as it is used everywhere.
core/commands/ptp.go
Outdated
|
||
handlerID, err = strconv.ParseUint(req.Arguments()[0], 10, 64) | ||
if err != nil { | ||
proto = "/ptp/" + req.Arguments()[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if someone creates protocol that is identified by decimal numbers?
If this is a problem right now, please fix it and create sharness test for it.
core/commands/ptp.go
Outdated
break | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here is quite complex, anyway to make it much simpler to read?
Probably it would be better to completly split off the close all, with handler, and with protocol into separate functions. Maybe even place them in the ptp package.
case "send": | ||
io.Copy(conn, os.Stdin) | ||
default: | ||
//TODO: a bit late |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Resolve this todo.
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
Here goes! :) |
Implemented experimental ptp(corenet) interface
Implemented experimental ptp(corenet) interface
Implemented experimental ptp(corenet) interface
This is built on #3518.
TODO: