proxychains

This commit is contained in:
AF 2024-09-28 23:46:23 +00:00
parent aa095cd55c
commit 0627cb817f
Signed by: alisa
SSH Key Fingerprint: SHA256:vNY4pdIZvO1FYJKHROkdHLtvyopizvZVAEwg9AF6h04
4 changed files with 24 additions and 9 deletions

View File

@ -2,8 +2,7 @@
FROM python:3.10
WORKDIR /v6
ENV v6root=/v6data
RUN apt-get update
RUN apt-get install -y libopus0 opus-tools ffmpeg
RUN apt-get update && apt-get install -y libopus0 opus-tools ffmpeg proxychains proxychains
COPY base.requirements.txt base.requirements.txt
RUN pip install -r base.requirements.txt
COPY requirements.txt requirements.txt
@ -13,4 +12,6 @@ ENV v6host=0.0.0.0
RUN mkdir ${v6root}
COPY v6d3music v6d3music
RUN python3 -m v6d3music.main
CMD ["python3", "-m", "v6d3music.run-bot"]
COPY proxychains.conf /etc/proxychains.conf
COPY entrypoint.sh /entrypoint.sh
CMD ["/entrypoint.sh"]

5
entrypoint.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
set -e
byedpi=$(dig +short byedpi)
sed -i -e 's/byedpi/'$byedpi'/g' /etc/proxychains.conf
exec python3 -m v6d3music.run-bot

9
proxychains.conf Normal file
View File

@ -0,0 +1,9 @@
quiet_mode
strict_chain
proxy_dns
tcp_read_time_out 15000
tcp_connect_time_out 8000
[ProxyList]
socks4 byedpi 1080

View File

@ -14,23 +14,23 @@ __all__ = ("FFmpegNormalAudio",)
class FFmpegNormalAudio(discord.FFmpegAudio):
def __init__(
self,
source,
source: str,
*,
executable="ffmpeg",
pipe=False,
stderr=None,
before_options=None,
options=None,
):
internal = source.startswith("http://adaas:5000/cachedx/")
executable = "ffmpeg" if internal else "proxychains"
self.source = source
args = []
subprocess_kwargs = {"stdin": source if pipe else subprocess.DEVNULL, "stderr": stderr}
args = [] if internal else ["ffmpeg"]
subprocess_kwargs = {"stdin": subprocess.DEVNULL, "stderr": stderr}
if isinstance(before_options, str):
args.extend(shlex.split(before_options))
args.append("-i")
args.append("-" if pipe else source)
args.append(source)
args.extend(("-f", "s16le", "-ar", "48000", "-ac", "2", "-loglevel", "warning"))
if isinstance(options, str):