socketmaster

command module
v0.0.0-...-7b1081a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2015 License: MIT Imports: 4 Imported by: 0

README

socketmaster

A zero-config reverse-proxy written in Go. See https://www.badgerodon.com/socketmaster.

Installation

Just use standard go get:

go get github.com/badgerodon/socketmaster

Usage

Run the socketmaster server:

socketmaster

And write a program that can connect to it:

package main

import (
	"fmt"
	"io"
	"net/http"
	"os"

	"github.com/badgerodon/socketmaster/client"
	"github.com/badgerodon/socketmaster/protocol"
)

func main() {
	li, err := client.Listen(protocol.SocketDefinition{
		Port: 8000,
	})
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	defer li.Close()

	http.HandleFunc("/", func(res http.ResponseWriter, req *http.Request) {
		io.WriteString(res, "Hello World")
	})
	err = http.Serve(li, nil)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}

Run that program and you should now be able to reach it:

curl localhost:8000/test

Documentation

https://godoc.org/github.com/badgerodon/socketmaster

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL