-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from rancher/testing
Merge testing
- Loading branch information
Showing
13 changed files
with
272 additions
and
248 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,28 +1,24 @@ | ||
package remotedialer | ||
|
||
import ( | ||
"context" | ||
"net" | ||
"time" | ||
) | ||
|
||
type Dialer func(network, address string) (net.Conn, error) | ||
type Dialer func(ctx context.Context, network, address string) (net.Conn, error) | ||
|
||
func (s *Server) HasSession(clientKey string) bool { | ||
_, err := s.sessions.getDialer(clientKey, 0) | ||
_, err := s.sessions.getDialer(clientKey) | ||
return err == nil | ||
} | ||
|
||
func (s *Server) Dial(clientKey string, deadline time.Duration, proto, address string) (net.Conn, error) { | ||
d, err := s.sessions.getDialer(clientKey, deadline) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return d(proto, address) | ||
} | ||
func (s *Server) Dialer(clientKey string) Dialer { | ||
return func(ctx context.Context, network, address string) (net.Conn, error) { | ||
d, err := s.sessions.getDialer(clientKey) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
func (s *Server) Dialer(clientKey string, deadline time.Duration) Dialer { | ||
return func(proto, address string) (net.Conn, error) { | ||
return s.Dial(clientKey, deadline, proto, address) | ||
return d(ctx, network, address) | ||
} | ||
} |
Oops, something went wrong.