Example #1
0
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
	"flag"
	oldlog "log"

	"github.com/sorintlab/pollon/Godeps/_workspace/src/github.com/coreos/pkg/capnslog"
)

var logLevel = capnslog.INFO
var log = capnslog.NewPackageLogger("github.com/coreos/pkg/capnslog/cmd", "main")
var dlog = capnslog.NewPackageLogger("github.com/coreos/pkg/capnslog/cmd", "dolly")

func init() {
	flag.Var(&logLevel, "log-level", "Global log level.")
}

func main() {
	rl := capnslog.MustRepoLogger("github.com/coreos/pkg/capnslog/cmd")

	// We can parse the log level configs from the command line
	flag.Parse()
	if flag.NArg() > 1 {
		cfg, err := rl.ParseLogLevelConfig(flag.Arg(1))
		if err != nil {
			log.Fatal(err)
Example #2
0
// See the License for the specific language governing permissions and
// limitations under the License.

package pollon

import (
	"fmt"
	"io"
	"net"
	"sync"
	"time"

	"github.com/sorintlab/pollon/Godeps/_workspace/src/github.com/coreos/pkg/capnslog"
)

var log = capnslog.NewPackageLogger("github.com/sorintlab/pollon", "pollon")

const (
	// min check interval
	minCheckInterval = 100 * time.Millisecond
)

type ConfChecker interface {
	Check() (destAddr *net.TCPAddr, err error)
}

type Proxy struct {
	listener     *net.TCPListener
	config       *Config
	confMutex    sync.Mutex
	destAddr     *net.TCPAddr