Skip to content
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

Sessions and Connections #1

Merged
merged 4 commits into from
Mar 8, 2019
Merged

Sessions and Connections #1

merged 4 commits into from
Mar 8, 2019

Conversation

akarl
Copy link
Collaborator

@akarl akarl commented Feb 25, 2019

No description provided.

Copy link
Member

@bombsimon bombsimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akarl: If you see yourself providing more changes (regarding my comments) in the near future I'm all OK with merging this. If you think this will be stale for a week or two I can leave this PR as is and we merge when we've provided more coded addressing my comments. What's your opinion?

fmt.Println("!!!", err.Error())
}

/*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't hur to keep this comment somewhere until we've figured out a way to handle commands and their namespaces.

MaxSessionLength: 10 * time.Minute,
Addr: ":4701",
Handler: RouteMessage,
Greeting: Greet,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea to have this as a separate field instead of a handler!

if len(rawCerts) != 1 {
return errors.New("dind't find one single client ceritficate")
}
func Greet(s *eppserver.Session) ([]byte, error) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work so I don't think it's a good idea to keep this as a default implementation of the greeter.

}

_, ok := c.PublicKey.(*rsa.PublicKey)
for _, xpath := range xpaths {
if xpath == "/epp/command/login" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be handled before even accepting the connection so this should not be a part of the router/message handler.

@@ -0,0 +1,69 @@
package eppserver
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like these methods, nice!

// ReadMessage reads one full message from r.
func ReadMessage(conn net.Conn) ([]byte, error) {
// https://tools.ietf.org/html/rfc5734#section-4
var totalSize uint32 = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't provided it yet but my default golangci-lint configuration doesn't like inits with default values.

@@ -11,7 +11,7 @@ func (s *Server) GreetResponse() ws.EppType {
return ws.EppType{
Greeting: &ws.GreetingType{
SvID: ws.SIDType{
Id: ws.ClIDType(s.ServerID),
Id: ws.ClIDType("asdb"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is WIP and all but this just looks bad, maybe a better default temporary value? :)

func (s *Server) processConnection(conn *tls.Conn) {
s.wg.Add(1)
func (s *Server) startSession(conn net.Conn, tlsConfig *tls.Config) {
// Initialize tls.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I can see that... 🤔

idleTimeout := time.After(s.IdleTimeout)

for {
select {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This select needs a case for when the client is disconnected (can we tell by looking at conn?) and also a way to inject custom rules like max allowed session etc. Or should we just make max allowed a configurable parameter?

enc := xml.NewEncoder(&xBuf)
enc.Indent("", " ")

if err := enc.EncodeElement(data, xml.StartElement{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe not drop this just yet if we want to test XML validity with a proper EPP library? I think this is OK to keep for a short while.

@bombsimon bombsimon merged commit e16a3e6 into master Mar 8, 2019
@bombsimon bombsimon deleted the session-connection branch March 8, 2019 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants