Skip to content

Commit

Permalink
reorg
Browse files Browse the repository at this point in the history
  • Loading branch information
bill committed Apr 20, 2012
1 parent 03b7e86 commit 43eea2a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/add/README
Expand Up @@ -2,10 +2,10 @@
This is a simple add service that happens over a TLS connection.

To run the server:
go run add.go
go run add.go --certdir certs

To run the client:
go run client/client.go
go run client/client.go --certdir certs

To see how certificates can be generated, check out makecert.sh

Expand Down
12 changes: 6 additions & 6 deletions examples/add/add.go
Expand Up @@ -2,17 +2,17 @@ package main

import (
"crypto/rand"
"crypto/tls"
"crypto/rsa"
"crypto/tls"
"flag"
"log"
"net"

"github.com/kylelemons/go-rpcgen/examples/add/addservice"
)

var (
certDir = flag.String("certdir","certs","The directory to load the X509 certificates from")
var (
certDir = flag.String("certdir", "certs", "The directory to load the X509 certificates from")
)

// Add is the type which will implement the addservice.AddService interface
Expand Down Expand Up @@ -43,8 +43,8 @@ func handleClient(conn net.Conn) {
state := tlscon.ConnectionState()
// Note we could reject clients if we don't like their public key.
for _, v := range state.PeerCertificates {
log.Printf("Client: Server public key is:\n%x\n",v.PublicKey.(*rsa.PublicKey).N)
// log.Printf("Server: client cert chain %s", v.Subject.ToRDNSequence())
log.Printf("Client: Server public key is:\n%x\n", v.PublicKey.(*rsa.PublicKey).N)
// log.Printf("Server: client cert chain %s", v.Subject.ToRDNSequence())
}
// Now that we have completed SSL/TLS
addservice.ServeAddService(tlscon, Add{})
Expand All @@ -56,7 +56,7 @@ func serverTLSListen(service string) {
// Load x509 certificates for our private/public key, makecert.sh will
// generate them for you.

log.Printf("Loading certificates from directory: %s\n",*certDir)
log.Printf("Loading certificates from directory: %s\n", *certDir)
cert, err := tls.LoadX509KeyPair(*certDir+"/server.pem", *certDir+"/server.key")
if err != nil {
log.Fatalf("server: loadkeys: %s", err)
Expand Down

0 comments on commit 43eea2a

Please sign in to comment.