Resurect net/balance, a generic TCP proxy with round robin features

PR:		193368
Submitted by:	Chris Hutchinson <portmaster@bsdforge.com>
This commit is contained in:
Rodrigo Osorio 2015-01-26 22:04:39 +00:00
parent e15611e1b5
commit 539bbf72e1
6 changed files with 135 additions and 0 deletions

View file

@ -40,6 +40,7 @@
SUBDIR += avahi-sharp
SUBDIR += axa
SUBDIR += babeld
SUBDIR += balance
SUBDIR += beacon
SUBDIR += beanstalkd
SUBDIR += belle-sip

25
net/balance/Makefile Normal file
View file

@ -0,0 +1,25 @@
# Created by: Joseph Scott <joseph@randomnetworks.com>
# $FreeBSD$
PORTNAME= balance
PORTVERSION= 3.56
CATEGORIES= net
MASTER_SITES= http://www.inlab.de/
MAINTAINER= portmaster@BSDforge.com
COMMENT= Simple but powerful generic TCP proxy with round robin features
LICENSE= GPLv2
ALL_TARGET= balance
USE_RC_SUBR= balance
pre-build:
@${REINPLACE_CMD} -e 's|^CFLAGS|CFLAGS?|' \
-e 's|^CC|CC?|' ${WRKSRC}/Makefile
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/balance ${STAGEDIR}${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/balance.1 ${STAGEDIR}${MANPREFIX}/man/man1
.include <bsd.port.mk>

2
net/balance/distinfo Normal file
View file

@ -0,0 +1,2 @@
SHA256 (balance-3.56.tar.gz) = 939a04eb5c89bd1a6b309a30507e36758dd9f1e90c76ed457c2c67b651dde89c
SIZE (balance-3.56.tar.gz) = 35477

View file

@ -0,0 +1,96 @@
#!/bin/sh
#
# $FreeBSD: head/net/balance/files/balance.in 340872 2014-01-24 00:14:07Z mat $
#
# PROVIDE: balance
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable balance:
#
#balance_enable="YES"
#balance_hosts="host1"
#balance_host1_flags="-a"
#balance_host1_address="host1.external.example"
#balance_host1_ports="http 8180"
#balance_host1_targets="host1.internal.example"
#
# See balance(8) for flags
#
. /etc/rc.subr
name=balance
rcvar=balance_enable
command=%%PREFIX%%/bin/balance
start_cmd=start_cmd
stop_cmd=stop_cmd
status_cmd=status_cmd
start_cmd()
{
if [ -x "${command}" ]; then
for host in ${balance_hosts}; do
eval ports=\"\${balance_${host}_ports}\"
eval flags=\"\${balance_${host}_flags}\"
eval address=\"\${balance_${host}_address}\"
eval targets=\"\${balance_${host}_targets}\"
if [ "" != "${address}" ]; then
flags="${flags} -b ${address}"
fi
for port in ${ports}; do
"${command}" ${flags} ${port} ${targets}
done
done
fi
}
stop_cmd()
{
if [ -x "${command}" ]; then
for host in ${balance_hosts}; do
eval ports=\"\${balance_${host}_ports}\"
eval address=\"\${balance_${host}_address}\"
flags=""
if [ "" != "${address}" ]; then
flags="-b ${address}"
else
address='*'
fi
for port in ${ports}; do
echo "balance at ${address}:${port}"
"${command}" ${flags} -c kill ${port}
done
done
fi
}
status_cmd()
{
if [ -x "${command}" ]; then
for host in ${balance_hosts}; do
eval ports=\"\${balance_${host}_ports}\"
eval address=\"\${balance_${host}_address}\"
flags=""
if [ "" != "${address}" ]; then
flags="-b ${address}"
else
address='*'
fi
for port in ${ports}; do
echo "balance at ${address}:${port}"
"${command}" ${flags} -c show ${port}
done
done
fi
}
# set defaults
balance_enable=${balance_enable:-"NO"}
load_rc_config $name
run_rc_command "$1"

9
net/balance/pkg-descr Normal file
View file

@ -0,0 +1,9 @@
Balance is a simple but powerful generic tcp proxy with round robin load
balancing and failover mechanisms. Its behaviour can be controlled at runtime
using a simple command line syntax.
The latest release now supports the definition of channel groups, connection
counting, and handling. Boosting the power, and versatility of balance, one
big step further.
WWW: http://www.inlab.de/balance.html

2
net/balance/pkg-plist Normal file
View file

@ -0,0 +1,2 @@
bin/balance
man/man1/balance.1.gz