move to codeberg

This commit is contained in:
2025-12-01 15:06:31 +01:00
parent d5b6de3aa4
commit bc78d3a123
11 changed files with 337 additions and 34 deletions

18
.woodpecker/build.yaml Normal file
View File

@@ -0,0 +1,18 @@
matrix:
platform:
- linux/amd64
labels:
platform: ${platform}
steps:
build-berkeley:
when:
event: [push]
image: alpine:latest
commands:
- apk update
- apk add --no-cache bash build-base gdb pkgconfig meson ninja
- meson setup --reconfigure build
- ninja -C build

54
.woodpecker/release.sh Executable file
View File

@@ -0,0 +1,54 @@
#!/bin/bash
# This is my own simple codeberg generic releaser. It takes to
# binaries to be uploaded as arguments and takes every other args from
# env. Works on tags or normal commits (push), tags must start with v.
set -e
die() {
echo $*
exit 1
}
if test -z "$DEPLOY_TOKEN"; then
die "token DEPLOY_TOKEN not set"
fi
git fetch --all
# determine current tag or commit hash
version="$CI_COMMIT_TAG"
previous=""
log=""
if test -z "$version"; then
version="${CI_COMMIT_SHA:0:6}"
log=$(git log -1 --oneline)
else
previous=$(git tag -l | grep -E "^v" | tac | grep -A1 "$version" | tail -1)
log=$(git log -1 --oneline "${previous}..${version}" | sed 's|^|- |g')
fi
# release body
printf "# Changes\n\n %s\n" "$log" > body.txt
# create the release
https --ignore-stdin --check-status -b -A bearer -a "$DEPLOY_TOKEN" POST \
"https://codeberg.org/api/v1/repos/${CI_REPO_OWNER}/${CI_REPO_NAME}/releases" \
tag_name="$version" name="Release $version" body=@body.txt > release.json
# we need the id to upload files
ID=$(jq -r .id < release.json)
if test -z "$ID"; then
cat release.json
die "failed to create release"
fi
# actually upload
for file in "$@"; do
https --ignore-stdin --check-status -A bearer -a "$DEPLOY_TOKEN" -f POST \
"https://codeberg.org/api/v1/repos/${CI_REPO_OWNER}/${CI_REPO_NAME}/releases/$ID/assets" \
"name=${file}" "attachment@${file}"
done

31
.woodpecker/release.yaml Normal file
View File

@@ -0,0 +1,31 @@
# build release
labels:
platform: linux/amd64
steps:
compile:
when:
event: [tag,manual]
image: alpine:latest
commands:
- apk update
- apk add --no-cache bash build-base words-en gdb pkgconfig meson ninja git
- meson setup --reconfigure --prefer-static -Dcpp_link_args="-static" --buildtype=release build
- ninja -C build
- meson dist -C build --formats xztar,gztar,zip
- file build/udpxd
- mv build/udpxd udpxd-linux-amd64-$CI_COMMIT_TAG
- mv build/meson-dist/* .
release:
image: alpine:latest
when:
event: [tag,manual]
environment:
DEPLOY_TOKEN:
from_secret: DEPLOY_TOKEN
commands:
- apk update
- apk add --no-cache bash httpie jq git
- .woodpecker/release.sh udpxd-*

View File

@@ -37,7 +37,7 @@ $(DST): $(OBJS)
$(CC) -c $(CFLAGS) $*.c -o $*.o
clean:
rm -f *.o $(DST)
rm -rf *.o $(DST) build .cache
man:
pod2man udpxd.pod > udpxd.1

View File

@@ -29,7 +29,7 @@ you need either BSD make or GNU make installed to build it.
First you need to check out the source code. Skip this, if
you have already done so:
git clone git@github.com:TLINDEN/udpxd.git
git clone https://codeberg.org/scip/udpxd.git
Next, change into the newly created directory 'udpxd' and
compile the source code:
@@ -53,8 +53,7 @@ Although I'm happy to hear from udpxd users in private email,
that's the best way for me to forget to do something.
In order to report a bug, unexpected behavior, feature requests
or to submit a patch, please open an issue on github:
https://github.com/TLINDEN/udpxd/issues.
or to submit a patch, [please open an issue](https://codeberg.org/scip/udpxd/issues).
## Copyright and license
@@ -66,4 +65,4 @@ T.v.Dein <tom AT vondein DOT org>
## Project homepage
https://github.com/TLINDEN/udpxd
https://codeberg.org/scip/udpxd

88
meson.build Normal file
View File

@@ -0,0 +1,88 @@
# -*-python-*-
project(
'udpxd',
'c',
license: 'GPL',
version: '0.0.4',
meson_version: '>=1.3',
default_options: [
'warning_level=2',
'werror=true',
],
)
add_project_arguments(
[
'-Wno-unused-parameter',
'-Wno-unused-result',
'-Wno-missing-braces',
'-Wno-format-zero-length',
'-Wvla',
'-Wno-sign-compare',
'-Wno-narrowing'
],
language: 'cpp',
)
c = meson.get_compiler('c')
conf = configuration_data()
# check for funcs.
foreach func : ['getopt', 'malloc', 'fprintf', 'strncpy', 'strlen', 'strtok', 'strchr', 'signal',
'select', 'free', 'perror', 'getsockname', 'setegid', 'seteuid', 'syslog',
'va_start', 'va_end', 'inet_ntop', 'getifaddrs', 'getnameinfo', 'ntohs', 'memcpy', 'memset', 'sprintf' ]
conf.set('HAVE_'+func.to_upper(), c.has_function(func, prefix : '#include <unistd.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <signal.h>\n#include <sys/socket.h>\n#include <syslog.h>\n#include <stdarg.h>\n#include <arpa/inet.h>\n#include <sys/types.h>\n#include <ifaddrs.h>\n#include <netdb.h>\n'))
endforeach
# check commandline options
prefix = get_option('prefix')
if get_option('buildtype') == 'debug'
conf.set('DEBUG', '1')
endif
# setup conf map
version = '@0@'.format(meson.project_version())
conf.set('prefix', prefix)
conf.set('UDPXD_VERSION', version)
# write out the config header
m = configure_file(
input : 'platform.h.in',
output : 'platform.h',
configuration : conf,
)
# code
udpxd_sources = files(
'client.c',
'host.c',
'log.c',
'net.c',
'udpxd.c'
)
executable(
'udpxd',
[udpxd_sources],
install: true
)
# build manual page
pod2man = find_program('pod2man', native: true)
if pod2man.found()
res = run_command(pod2man.full_path(), 'udpxd.pod', 'udpxd.1', check:true)
if res.returncode() == 0
install_man('udpxd.1')
endif
endif

1
meson_options.txt Normal file
View File

@@ -0,0 +1 @@
# custom build options

101
platform.h.in Normal file
View File

@@ -0,0 +1,101 @@
/* platform.h.in. Generated from configure.ac by autoheader. */
#define PACKAGE "udpxd"
#define UDPXD_VERSION "@VERSION@"
#mesondefine HAVE_GETOPT
#ifndef HAVE_GETOPT
error "HAVE_GETOPT not defined"
#endif
#mesondefine HAVE_MALLOC
#ifndef HAVE_MALLOC
error "HAVE_MALLOC not defined"
#endif
#mesondefine HAVE_FPRINTF
#ifndef HAVE_FPRINTF
error "HAVE_FPRINTF not defined"
#endif
#mesondefine HAVE_STRNCPY
#ifndef HAVE_STRNCPY
error "HAVE_STRNCPY not defined"
#endif
#mesondefine HAVE_STRLEN
#ifndef HAVE_STRLEN
error "HAVE_STRLEN not defined"
#endif
#mesondefine HAVE_STRTOK
#ifndef HAVE_STRTOK
error "HAVE_STRTOK not defined"
#endif
#mesondefine HAVE_STRCHR
#ifndef HAVE_STRCHR
error "HAVE_STRCHR not defined"
#endif
#mesondefine HAVE_SIGNAL
#ifndef HAVE_SIGNAL
error "HAVE_SIGNAL not defined"
#endif
#mesondefine HAVE_SELECT
#ifndef HAVE_SELECT
error "HAVE_SELECT not defined"
#endif
#mesondefine HAVE_FREE
#ifndef HAVE_FREE
error "HAVE_FREE not defined"
#endif
#mesondefine HAVE_PERROR
#ifndef HAVE_PERROR
error "HAVE_PERROR not defined"
#endif
#mesondefine HAVE_GETSOCKNAME
#ifndef HAVE_GETSOCKNAME
error "HAVE_GETSOCKNAME not defined"
#endif
#mesondefine HAVE_SETEGID
#ifndef HAVE_SETEGID
error "HAVE_SETEGID not defined"
#endif
#mesondefine HAVE_SETEUID
#ifndef HAVE_SETEUID
error "HAVE_SETEUID not defined"
#endif
#mesondefine HAVE_SYSLOG
#ifndef HAVE_SYSLOG
error "HAVE_SYSLOG not defined"
#endif
#mesondefine HAVE_VA_START
#ifndef HAVE_VA_START
error "HAVE_VA_START not defined"
#endif
#mesondefine HAVE_VA_END
#ifndef HAVE_VA_END
error "HAVE_VA_END not defined"
#endif
#mesondefine HAVE_INET_NTOP
#ifndef HAVE_INET_NTOP
error "HAVE_INET_NTOP not defined"
#endif
#mesondefine HAVE_GETIFADDRS
#ifndef HAVE_GETIFADDRS
error "HAVE_GETIFADDRS not defined"
#endif
#mesondefine HAVE_GETNAMEINFO
#ifndef HAVE_GETNAMEINFO
error "HAVE_GETNAMEINFO not defined"
#endif
#mesondefine HAVE_NTOHS
#ifndef HAVE_NTOHS
error "HAVE_NTOHS not defined"
#endif
#mesondefine HAVE_MEMCPY
#ifndef HAVE_MEMCPY
error "HAVE_MEMCPY not defined"
#endif
#mesondefine HAVE_MEMSET
#ifndef HAVE_MEMSET
error "HAVE_MEMSET not defined"
#endif
#mesondefine HAVE_SPRINTF
#ifndef HAVE_SPRINTF
error "HAVE_SPRINTF not defined"
#endif

44
udpxd.1
View File

@@ -1,4 +1,4 @@
.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
.\"
.\" Standard preamble:
.\" ========================================================================
@@ -38,27 +38,36 @@
. ds PI \(*p
. ds L" ``
. ds R" ''
. ds C`
. ds C'
'br\}
.\"
.\" Escape single quotes in literal strings from groff's Unicode transform.
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" If the F register is >0, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
.\" entries marked with X<> in POD. Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
.\"
.\" Avoid warning from groff about undefined register 'F'.
.de IX
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
.nr rF 0
.if \n(.g .if rF .nr rF 1
.if (\n(rF:(\n(.g==0)) \{\
. if \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. if !\nF==2 \{\
. nr % 0
. nr F 2
. \}
. \}
.\}
.rr rF
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear. Run. Save yourself. No user-serviceable parts.
@@ -124,7 +133,7 @@
.\" ========================================================================
.\"
.IX Title "UDPXD 1"
.TH UDPXD 1 "2015-2016-04-27" "perl v5.14.2" "User Contributed Perl Documentation"
.TH UDPXD 1 "2025-12-01" "perl v5.34.0" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@@ -138,7 +147,8 @@ udpxd \- A general purpose UDP relay/port forwarder/proxy
\&
\& Options:
\& \-\-listen \-l <ip:port> listen for incoming requests
\& \-\-bind \-b <ip> bind ip used for outgoing requests
\& \-\-bind \-b <ip[:port]> bind ip used for outgoing requests
\& specify port for promiscuous mode
\& \-\-to \-t <ip:port> destination to forward requests to
\& \-\-daemon \-d daemon mode, fork into background
\& \-\-pidfile \-p <file> pidfile, default: /var/run/udpxd.pid
@@ -178,7 +188,9 @@ the background and becomes a daemon. It writes it pidfile to
\&\f(CW\*(C`/var/run/udpxd.pid\*(C'\fR, which can be changed with the \fB\-p\fR
option. If started as root, it also drops privileges to the
user \f(CW\*(C`nobody\*(C'\fR or the user specified with \fB\-u\fR and chroots
to \f(CW\*(C`/var/empty\*(C'\fR or the directory specified with \fB\-c\fR.
to \f(CW\*(C`/var/empty\*(C'\fR or the directory specified with \fB\-c\fR. udpxd
will log to syslog facility user.info if \fB\-v\fR is specified and
if running in daemon mode.
.PP
\&\fBCaution: if not running in daemon mode, udpxd does not drop
its privileges and will continue to run as root (if started as
@@ -275,12 +287,12 @@ address:
.IX Header "BUGS"
In order to report a bug, unexpected behavior, feature requests
or to submit a patch, please open an issue on github:
<https://github.com/TLINDEN/udpxd/issues>.
<https://codeberg.org/scip/udpxd/issues>.
.SH "LICENSE"
.IX Header "LICENSE"
This software is licensed under the \s-1GNU\s0 \s-1GENERAL\s0 \s-1PUBLIC\s0 \s-1LICENSE\s0 version 3.
This software is licensed under the \s-1GNU GENERAL PUBLIC LICENSE\s0 version 3.
.PP
Copyright (c) 2015-2016 by T. v. Dein.
Copyright (c) 2015\-2017 by T. v. Dein.
.PP
This software uses \fButhash\fR (bundled), which is
Copyright (c) 2003\-2013 by Troy D. Hanson.

23
udpxd.h
View File

@@ -22,22 +22,21 @@
#ifndef _HAVE_UDPXD_H
#define _HAVE_UDPXD_H
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdint.h>
#include <unistd.h>
#include <time.h>
#include <getopt.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/fcntl.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#define UDPXD_VERSION "0.0.4"
#include "platform.h"
void usage();
int parse_ip(char *src, char *ip, char *pt);

View File

@@ -135,7 +135,7 @@ B</var/run/udpxd.pid>: created if running in daemon mode (B<-d>).
In order to report a bug, unexpected behavior, feature requests
or to submit a patch, please open an issue on github:
L<https://github.com/TLINDEN/udpxd/issues>.
L<https://codeberg.org/scip/udpxd/issues>.
=head1 LICENSE