Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
cmd
 
 
 
 
 
 
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

DIAMOND ⋄

Runlevels for your web application

telinit 3

GoDoc Build Status

Screenshot diamond-admin CUI

Using diamond-admin

You can open admin interface by using no arguments:

diamond-admin -s diamond.sock

Start all listeners and http servers

diamond-admin -s diamond.sock RUNLEVEL 3

Stop all listeners, cut http connections

diamond-admin -s diamond.sock RUNLEVEL 1

Using the library

Diamond requires a recent version of Go


// New creates a new admin socket and starts listening for commands
s, err := diamond.New("/tmp/diamond.socket")
if err != nil {
    log.Fatalln(err)
}

// Add variety of http handlers and their addr to listen on
// They won't start listening right away, so they could be
// occupied by other servers
s.AddHTTPHandler(":8080", http.HandlerFunc(myHandler))
s.AddHTTPHandler(":8081", http.HandlerFunc(handler2))
s.AddHTTPHandler(":8082", handler3)

// start in multiuser mode, serving http
// without calling Runlevel(3) you must
// connect via socket and issue the RUNLEVEL 3 command
s.Runlevel(3) 

// serve forever
log.Fatalln(s.Wait())

See the examples

Read more:

aerth.github.io/diamond

github.com/aerth/diamond

CAUTION

API may change without notice! (it already has two times!)

Contributing

Submit new issue or pull request

Old version

import "gopkg.in/aerth/diamond.v1"
You can’t perform that action at this time.