Skip to content

Commit

Permalink
fix the error tip and add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
conwnet committed Mar 22, 2020
1 parent b4aa2f0 commit b3517e0
Show file tree
Hide file tree
Showing 19 changed files with 301 additions and 184 deletions.
22 changes: 11 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
*.pyc
*.pyo
.DS*
.pylint_rc
/.idea
/.project
/.pydevproject
/.settings
Thumbs.db
*~
.cache
*.pyc
*.pyo
.DS*
.pylint_rc
/.idea
/.project
/.pydevproject
/.settings
Thumbs.db
*~
.cache
40 changes: 20 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
language: python
matrix:
include:
- python: "2.6"
- python: "2.7"
- python: "2.7.10"
- python: "2.7.11"
allow_failures:
- python: "3.2"
- python: "3.3"
- python: "3.4"
- python: "3.5"
- python: "nightly"
# command to install dependencies
install:
- pip install python-dateutil pytest
# command to run tests
script: py.test -v

language: python
matrix:
include:
- python: "2.6"
- python: "2.7"
- python: "2.7.10"
- python: "2.7.11"
allow_failures:
- python: "3.2"
- python: "3.3"
- python: "3.4"
- python: "3.5"
- python: "nightly"

# command to install dependencies
install:
- pip install python-dateutil pytest
# command to run tests
script: py.test -v

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Guoqing Zhang <[email protected]> (conw.net)
Copyright (c) 2019 Guoqing Zhang <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
44 changes: 40 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
# Shadowsocks-kodi

Run Shadowsocks on kodi!


<p align="center"><a href="https://vuejs.org" target="_blank" rel="noopener noreferrer"><img width="200" src="https://github.com/conwnet/shadowsocks-kodi/raw/master/resources/icon.png" alt="Shadowsocks Kodi logo"></a></p>


<h3 align="center">
Run Shadowsocks on Kodi!
</h3>

## Get Started

You can download the latest version from [Github Releases](https://github.com/conwnet/shadowsocks-kodi/releases)

1. Install the addon on your kodi.
2. Configure your Shadowsocks.
3. Restart services to take effect.

## Check up

You can login your kodi with ssh and display the ports usage.

As shown below, we can see our Shadowsocks services running at PID 653.

```
LibreELEC:~ # netstat -lntp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
...
tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN 653/kodi.bin
...
```

You can test whether your services work as your expected use `curl`.

```
LibreELEC:~ # curl -x socks5://127.0.0.1:1080 ifconfig.io/ip
```

## Screenshots

![Shadowsocks kodi](./resources/screenshot-01.png)
61 changes: 35 additions & 26 deletions addon.xml
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.sslocal" name="Shadowsocks" version="0.0.1" provider-name="netcon">
<requires>
<import addon="xbmc.python" version="2.24.0"/>

<import addon="script.module.simplejson" version="3.3.0"/>
</requires>
<extension point="xbmc.service" library="main.py" start="startup"/>
<extension point="xbmc.addon.metadata">
<summary>Shadowsocks Client</summary>
<description></description>
<language></language>
<platform>linux</platform>
<license>MIT</license>
<forum></forum>
<website>conw.net</website>
<email>[email protected]</email>
<source></source>
<news></news>
<disclaimer></disclaimer>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
</assets>
</extension>
</addon>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="service.shadowsocks" name="Shadowsocks" version="0.0.1" provider-name="netcon">
<requires>
<import addon="xbmc.python" version="2.24.0"/>
</requires>
<extension point="xbmc.service" library="main.py" start="startup"/>
<extension point="xbmc.addon.metadata">
<summary>Shadowsocks for Kodi</summary>
<description>
Usage:
1. Click `Configure` to fill in your server config
2. Click `Disable` to stop existing service
3. Click `Enable` to start service with the current config

You have already established a SOCKS5 proxy on your kodi!
Github: https://github.com/conwnet/shadowsocks-kodi
</description>
<language></language>
<platform>linux</platform>
<license>MIT</license>
<forum></forum>
<website>conw.net</website>
<email>[email protected]</email>
<source></source>
<news></news>
<disclaimer></disclaimer>
<assets>
<icon>resources/icon.png</icon>
<fanart>resources/fanart.jpg</fanart>
<screenshot>resources/screenshot-01.png</screenshot>
<screenshot>resources/screenshot-02.png</screenshot>
<screenshot>resources/screenshot-03.png</screenshot>
</assets>
</extension>
</addon>
2 changes: 1 addition & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
v0.0.1
v0.0.1
- Initial version
50 changes: 41 additions & 9 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,41 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# run service

from resources import service

if __name__ == '__main__':
service.run()

#!/usr/bin/env python
# -*- coding: utf-8 -*-
# run service

from src import service, async_task, helpers
import logging
import xbmc

# set logging to xbmc.log
def set_logging():
class Handler(logging.Handler):
def __init__(self):
logging.Handler.__init__(self)
def emit(self, record):
message = self.format(record)
xbmc.log(message, level=xbmc.LOGNOTICE)

logger = logging.getLogger()
logger.addHandler(Handler())

if __name__ == '__main__':
set_logging()
config = helpers.get_config()

def run_service():
if not config['server']:
return
service.run(config)

task = async_task.AsyncTask(run_service, config['pid-file'])

# try stop existing process,
# on normal case it not required
task.stop()
task.start()

monitor = xbmc.Monitor()
while not monitor.abortRequested():
if monitor.waitForAbort(10):
task.stop()
break
Binary file added resources/fanart.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/screenshot-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/screenshot-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/screenshot-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
93 changes: 0 additions & 93 deletions resources/service.py

This file was deleted.

36 changes: 18 additions & 18 deletions resources/settings.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="Necessary">
<setting label="Necessary Parameters" type="lsep" />
<setting label="SERVER_ADDR" id="server_addr" type="text" />
<setting label="SERVER_PORT" id="server_port" type="number" default="8388" />
<setting label="METHOD" id="method" type="select" default="aes-256-cfb" values="aes-128-gcm|aes-192-gcm|aes-256-gcm|aes-128-cfb|aes-192-cfb|aes-256-cfb|aes-128-ctr|aes-192-ctr|aes-256-ctr|camellia-128-cfb|camellia-192-cfb|camellia-256-cfb|bf-cfb|chacha20-ietf-poly1305|xchacha20-ietf-poly1305|salsa20|chacha20|chacha20-ietf|rc4-md5" />
<setting label="PASSWORD" id="password" type="text" option="hidden" default="" />
</category>
<category label="Optional">
<setting label="Optional Parameters" type="lsep" />
<setting label="LOCAL_ADDR" id="local_addr" type="text" default="127.0.0.1" />
<setting label="LOCAL_PORT" id="local_port" type="number" default="1080" />
<setting label="TIMEOUT" id="timeout" type="number" default="300" />
<setting label="ONE_TIME_AUTH" id="one_time_auto" type="bool" default="false" />
<setting label="TCP_FASTOPEN" id="tcp_fast_open" type="bool" default="false" />
</category>
</settings>
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
<category label="Required">
<setting label="Required Parameters" type="lsep" />
<setting label="SERVER_ADDR" id="server_addr" type="text" />
<setting label="SERVER_PORT" id="server_port" type="number" default="8388" />
<setting label="METHOD" id="method" type="select" default="aes-256-cfb" values="aes-128-gcm|aes-192-gcm|aes-256-gcm|aes-128-cfb|aes-192-cfb|aes-256-cfb|aes-128-ctr|aes-192-ctr|aes-256-ctr|camellia-128-cfb|camellia-192-cfb|camellia-256-cfb|bf-cfb|chacha20-ietf-poly1305|xchacha20-ietf-poly1305|salsa20|chacha20|chacha20-ietf|rc4-md5" />
<setting label="PASSWORD" id="password" type="text" option="hidden" default="" />
</category>
<category label="Optional">
<setting label="Optional Parameters" type="lsep" />
<setting label="LOCAL_ADDR" id="local_addr" type="text" default="127.0.0.1" />
<setting label="LOCAL_PORT" id="local_port" type="number" default="1080" />
<setting label="TIMEOUT" id="timeout" type="number" default="300" />
<setting label="ONE_TIME_AUTH" id="one_time_auto" type="bool" default="false" />
<setting label="TCP_FASTOPEN" id="tcp_fast_open" type="bool" default="false" />
</category>
</settings>
File renamed without changes.
Loading

0 comments on commit b3517e0

Please sign in to comment.