Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor asn and geoip handling #10

Closed
wants to merge 71 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
098c515
firlarr dirname patch
darix Mar 6, 2017
25d49a2
revert 82223 patch
darix Mar 6, 2017
cf4ad89
mlzsync patch
darix Mar 6, 2017
43b687e
dont crash on empty result set
darix Mar 6, 2017
3cdaea6
fallback to remote addr
darix Mar 6, 2017
74fc698
error handling rsync scan
darix Mar 6, 2017
90c367c
geoipv6 patch
darix Mar 6, 2017
51c36f1
forgot the migration file for the filearr patch
darix Mar 6, 2017
71cafaa
Query the datase for servers that use the same protocol as the client…
DimStar77 Feb 23, 2017
2de40bc
Updated Database schema
DimStar77 Feb 23, 2017
ddc72b9
No reference to the table, we should just drop asn and prefix from se…
DimStar77 Feb 23, 2017
38ad122
Updated database schema
DimStar77 Feb 23, 2017
da5289a
Have mb iplookup <mirror> lookup ipv and ipv6 data for us
DimStar77 Feb 23, 2017
a6c4cd6
mb: show and edit are not able to handle asn and prefix anymore
DimStar77 Feb 23, 2017
10877ce
mb show: list the registered prefixes and AS
DimStar77 Feb 24, 2017
e4e9e9b
mb show: nicer output of the prefix/asn overview
DimStar77 Feb 24, 2017
cc9a206
asn: use socket.AF_INET6 instead of 'guessing' based on a ':' in the …
DimStar77 Feb 24, 2017
3eeacd0
Add af_from_string: detect address family based on a string
DimStar77 Feb 24, 2017
5450b9b
mb update -p: handle the changes in the database schema
DimStar77 Feb 24, 2017
84b8e16
Update database schema
DimStar77 Feb 24, 2017
80cf86f
Do only overwrite the first entry in the db per address family
DimStar77 Feb 24, 2017
569fbc6
mb update: delete prefixes that are not found by iplookup
DimStar77 Feb 24, 2017
b82a088
mb update -a: Update Autonomous System for prefixes
DimStar77 Feb 24, 2017
00ba24b
mb new: handle the addition of ip related settings with an internal c…
DimStar77 Feb 24, 2017
d7a0f10
IpAddress: ensure prefix6 is defined even when unset
DimStar77 Feb 24, 2017
631b03f
mb new: exit without traceback when no region could be identified
DimStar77 Feb 24, 2017
7891050
iplookup: not having an ipv4 address is no reason to crash
DimStar77 Feb 24, 2017
502cc8a
mb delete: remove prefixes/as relating to the deleted mirror
DimStar77 Feb 24, 2017
6d012a1
mb new: only get prefix and asn using do_update
DimStar77 Feb 24, 2017
a01256c
af_from_string: don't expect a prefix, but also work with an IP address
DimStar77 Feb 24, 2017
f33067d
lookup_country_code: use geoiplookup6 for ipv6 addresses
DimStar77 Feb 24, 2017
67da19f
mb new: save some dns lookups and support querying geoip using ipv6
DimStar77 Feb 24, 2017
5942c94
mb list: query asn and prefix from the serverpfx table
DimStar77 Feb 25, 2017
d09955d
ms list: make clear where ASNs and Prefixes are
DimStar77 Feb 25, 2017
27ec528
Merge pull request #1 from DimStar77/ipv6-prefixes
darix Aug 24, 2017
c5cef79
Remove unused file info from rsync reader
andrii-suse Feb 28, 2020
2a9cb9f
Do not collect full file list in rsync reader if callback is provided
andrii-suse Feb 28, 2020
4750cb2
Produce sorted output in rsync reader
andrii-suse Feb 28, 2020
09ddc7b
Delete files in sorted order to reduce deadlock chance
andrii-suse Feb 28, 2020
5fbcec9
Enhance README.md with some Marketing information
lrupp Mar 20, 2020
ea2bb4f
Be able add server even if no IP data available
andrii-suse Mar 24, 2020
20a38cf
Add docker test
andrii-suse Mar 24, 2020
08eec6a
Add .gitignore
andrii-suse Mar 24, 2020
6181364
Add CI
andrii-suse Mar 24, 2020
b11ab9b
Commit every directory in rsync scanner
andrii-suse Mar 27, 2020
59299d7
next version is 2.19.2
darix Mar 27, 2020
9dd85de
Make syntax python3 compatible
darix Mar 27, 2020
e971958
Merge pull request #5 from andrii-suse/fix_deadlocks
darix Mar 27, 2020
ce209a2
Merge pull request #6 from andrii-suse/add_ci
darix Mar 27, 2020
24cc49c
ignore compiled python files
darix Mar 27, 2020
0428e61
revert debug code
darix Mar 27, 2020
4a7c871
More print syntax fixes
darix Mar 28, 2020
6e9fbf6
fix syntax errors in previous commit
darix Mar 28, 2020
4d5ba48
make the syntax work on python2 as well
darix Mar 28, 2020
7a33a06
use proper import for mberr
darix Mar 28, 2020
d643f98
use the new config parser syntax
darix Mar 28, 2020
8b828f8
Make configparser handling work on py2 and py3
darix Mar 28, 2020
505f6b9
Make urlparser work on py2 and py3
darix Mar 28, 2020
590a96c
Make mb and the tools python3 only
darix Mar 29, 2020
621e29d
We still need to import configparser
darix Mar 29, 2020
95c57b6
Port ASN lookup from mod_asn to maxminddb
darix Mar 29, 2020
3cfff67
Move mb to python3
andrii-suse Mar 31, 2020
a389910
Fix ci test
andrii-suse Mar 31, 2020
64f3485
Add maxmindb test
andrii-suse Apr 1, 2020
8c7e87c
Add python test for hashes
andrii-suse Apr 2, 2020
e210526
Merge pull request #8 from andrii-suse/test_location
darix Apr 2, 2020
6b7206f
just a simple helper tool to find syntax errors
darix Apr 2, 2020
f93b312
ignore mmdb files
darix Apr 2, 2020
af3a5f7
Version is not optional
darix Apr 1, 2020
286d2dc
Add lat/lng to the city DB
darix Apr 16, 2020
bb38a9d
Add helpers scripts that se used to create the test DBs
darix Apr 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: 2.1

jobs:
test_mb:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
command: |
pyenv versions
pyenv global 3.7.0
make test_mb

integration:
machine:
image: ubuntu-1604:201903-01
steps:
- checkout
- run:
command: |
pyenv versions
pyenv global 3.7.0
git clone https://github.com/coryb/osht ../osht
docker pull registry.opensuse.org/home/andriinikitin/containers/serviced
sudo chown -R 1000:1000 .
make test_docker PRIVILEGED_TESTS=1 OSHT_LOCATION=$(pwd)/../osht/osht.sh
workflows:
version: 2.1
test:
jobs:
- test_mb
- integration
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**/__pycache__/
/**/*.pyc
mb/build
mod_mirrorbrain/.libs
mod_mirrorbrain/mod_mirrorbrain.la
mod_mirrorbrain/mod_mirrorbrain.lo
mod_mirrorbrain/mod_mirrorbrain.slo
t/docker/lib/src/sql
/**/*.mmdb
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

test_mb:
( cd mb && PYTHONPATH=. python -m unittest discover -p '*tests.py' tests -v )

test_docker:
bash t/test_docker.sh
45 changes: 45 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,48 @@

This code used to live in Subversion so far, hosted on mirrorbrain.org. Maybe it's time to experiment with moving to GitHub.
*poeml, Mon 11 May 2015 23:06:47 CEST*

# What is it?

MirrorBrain is an open source framework to run a content delivery network using mirror servers. It solves a challenge that many popular open source projects face - a flood of download requests, often magnitudes more than any single site could practically handle.

The central (and probably the most obvious) part is a "download redirector" which automatically redirects requests from web browsers or download programs to a mirror server near them.

One example of a running instance is http://download.opensuse.org/

# Features

For clients (users):

* allows to have one central URL for clients to download content
* uses geolocation and global routing data to find the closest mirror for clients
* automatically keeps cryptohashes of all files and can serve these on request
* optionally generates Metalinks ([RFC5854](https://tools.ietf.org/html/rfc5854)) and Torrents in realtime
* provides automatically generated mirror list for overview (For example: https://mirrors.opensuse.org/)
* Allows to list available mirrors for single files to choose ([example](http://download.opensuse.org/distribution/openSUSE-current/repo/oss/README.mirrorlist))

For mirrors:

* load-balancing of mirrors, based on weighting
* ability to limit requests for a mirror to its own network or country
* file level granularity (mirrors don't have to mirror the full file tree - they can choose what they want)
* reliably assess large file support of mirrors

For admins of a MirrorBrain server:

* has proven to handle hundreds of requests per second
* ability to NOT redirect certain requests, for security reasons
* content on mirrors can be protected by URL signing (clients can only download from mirrors if they successfully authenticated with the MirrorBrain server)
* commandline tools and Python module for maintenance tasks
* support for running behind a load balancer, using e.g. X-Forwarded-for header for the clients IP address
* integrated in Apaches module API, for compatibility with numerous other existing Apache modules, e.g. SSL
* multiple instances are supported to run in one Apache (one per virtual host)
* flexible logging
* more than a redirector
* serve automatically generated cryptohashes (MD5, SHA1, SHA256)
* generation of [RFC5854](https://tools.ietf.org/html/rfc5854) Metalinks
* support for [RFC3230](https://tools.ietf.org/html/rfc3230) - Instance Digests in HTTP
* support for [RFC6249](https://tools.ietf.org/html/rfc6249) - Metalink/HTTP: Mirrors and Hashes
* generation of Torrents (including the closest mirrors as seeds)
* support for zsync
* support for native Yum mirror lists, compatible to Fedora and CentOS
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
# built documents.
#
# The short X.Y version.
version = '2.19.0'
version = '2.19.2'
# The full version, including alpha/beta/rc tags.
release = '2.19.0'
release = '2.19.2'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
10 changes: 10 additions & 0 deletions mb/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PY_FILES=mb.py mb/*.py
PYC_FILES=$(wildcard *.pyc mb/*.pyc mb/crawlers/__pycache__/ mb/__pycache__/ __pycache__/)

all: $(PY_FILES)
python3 -m compileall $^

clean: $(PYCF_FILES)
ifdef PYC_FILES
rm -rv $(PYC_FILES)
endif
Loading