Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
b2fe5727
Commit
b2fe5727
authored
Sep 15, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
496bd425
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
1 deletion
+7
-1
go/xcommon/xnet/net.go
go/xcommon/xnet/net.go
+2
-0
go/xcommon/xnet/pipenet/pipenet.go
go/xcommon/xnet/pipenet/pipenet.go
+5
-1
No files found.
go/xcommon/xnet/net.go
View file @
b2fe5727
...
@@ -47,6 +47,7 @@ type Networker interface {
...
@@ -47,6 +47,7 @@ type Networker interface {
// NetPlain creates Networker corresponding to regular network accessors from std package net.
// NetPlain creates Networker corresponding to regular network accessors from std package net.
//
// network is "tcp", "tcp4", "tcp6", "unix", etc...
// network is "tcp", "tcp4", "tcp6", "unix", etc...
func
NetPlain
(
network
string
)
Networker
{
func
NetPlain
(
network
string
)
Networker
{
return
netPlain
(
network
)
return
netPlain
(
network
)
...
@@ -68,6 +69,7 @@ func (n netPlain) Listen(laddr string) (net.Listener, error) {
...
@@ -68,6 +69,7 @@ func (n netPlain) Listen(laddr string) (net.Listener, error) {
}
}
// NetTLS wraps underlying networker with TLS layer according to config.
// NetTLS wraps underlying networker with TLS layer according to config.
//
// The config must be valid:
// The config must be valid:
// - for tls.Client -- for Dial to work,
// - for tls.Client -- for Dial to work,
// - for tls.Server -- for Listen to work.
// - for tls.Server -- for Listen to work.
...
...
go/xcommon/xnet/pipenet/pipenet.go
View file @
b2fe5727
...
@@ -131,6 +131,7 @@ type dialReq struct {
...
@@ -131,6 +131,7 @@ type dialReq struct {
//trace:event traceNew(name string)
//trace:event traceNew(name string)
// New creates new pipenet Network
// New creates new pipenet Network
//
// name is name of this network under "pipe" namespace, e.g. "α" will give full network name "pipeα".
// name is name of this network under "pipe" namespace, e.g. "α" will give full network name "pipeα".
//
//
// New does not check whether network name provided is unique.
// New does not check whether network name provided is unique.
...
@@ -143,7 +144,8 @@ func New(name string) *Network {
...
@@ -143,7 +144,8 @@ func New(name string) *Network {
//trace:event traceNewHost(host *Host)
//trace:event traceNewHost(host *Host)
// Host returns network access point by name
// Host returns network access point by name
// if there was no such host before it creates new one
//
// If there was no such host before it creates new one.
func
(
n
*
Network
)
Host
(
name
string
)
*
Host
{
func
(
n
*
Network
)
Host
(
name
string
)
*
Host
{
n
.
mu
.
Lock
()
n
.
mu
.
Lock
()
defer
n
.
mu
.
Unlock
()
defer
n
.
mu
.
Unlock
()
...
@@ -183,6 +185,7 @@ func (h *Host) resolveAddr(addr string) (host *Host, port int, err error) {
...
@@ -183,6 +185,7 @@ func (h *Host) resolveAddr(addr string) (host *Host, port int, err error) {
//trace:event traceListen(laddr string)
//trace:event traceListen(laddr string)
// Listen starts new listener
// Listen starts new listener
//
// It either allocates free port if laddr is "" or with 0 port, or binds to laddr.
// It either allocates free port if laddr is "" or with 0 port, or binds to laddr.
// Once listener is started, Dials could connect to listening address.
// Once listener is started, Dials could connect to listening address.
// Connection requests created by Dials could be accepted via Accept.
// Connection requests created by Dials could be accepted via Accept.
...
@@ -300,6 +303,7 @@ func (l *listener) Accept() (net.Conn, error) {
...
@@ -300,6 +303,7 @@ func (l *listener) Accept() (net.Conn, error) {
//trace:event traceDial(addr string)
//trace:event traceDial(addr string)
// Dial dials address on the network
// Dial dials address on the network
//
// It tries to connect to Accept called on listener corresponding to addr.
// It tries to connect to Accept called on listener corresponding to addr.
func
(
h
*
Host
)
Dial
(
ctx
context
.
Context
,
addr
string
)
(
net
.
Conn
,
error
)
{
func
(
h
*
Host
)
Dial
(
ctx
context
.
Context
,
addr
string
)
(
net
.
Conn
,
error
)
{
traceDial
(
addr
)
traceDial
(
addr
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment