Skip to content

Commit 7fea691

Browse files
committed
added command line access
1 parent f7a22c9 commit 7fea691

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ my_ans_server.add_user("client_address")
3939
my_ans_server.run()
4040
```
4141

42+
also you can use in command line:
43+
```console
44+
ans --password MyNarunoPass --encrypt_key "mystrongencrypt_key" --trusted_users ["client_address"] run
45+
```
46+
4247
### Client
4348
To use ANS, you can call the ans.ip function with your blockchain address as the parameter:
4449

@@ -47,13 +52,19 @@ from address_name_system import ans
4752

4853
my_ans_client = ans("MyNarunoPass")
4954

50-
ip_address = my_ans_client.ip("server_address", "mystrongpass")
55+
ip_address = my_ans_client.ip("server_address", "mystrongencrypt_key")
5156

5257
print(ip_address)
5358

5459
my_ans_client.close()
5560
```
5661

62+
also you can use in command line:
63+
```console
64+
ans --password "MyNarunoPass" ip "server_address" "mystrongencrypt_key"
65+
```
66+
67+
5768
This will return the dynamic IP address associated with your blockchain address.
5869

5970
## Contributing

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
fire==0.5.0

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
license='MIT',
1313
packages=["address_name_system"],
1414
package_dir={'':'src'},
15+
install_requires="".join(open("requirements.txt", encoding="utf-8").readlines()),
1516
entry_points = {
16-
'console_scripts': ['mysystemmonitor=mysystemmonitor.mysystemmonitor:main'],
17+
'console_scripts': ['ans=address_name_system.address_name_system:main'],
1718
},
1819
python_requires=">= 3",
1920
zip_safe=False)

src/address_name_system/address_name_system.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import contextlib
88

99
import time
10-
10+
import fire
1111

1212
class ans:
1313
def __init__(self, password, encrypt_key=None, trusted_users=[], self_ip_cache_time=3600, ip_cache_time=360, port=8000):
@@ -100,4 +100,7 @@ def run(self):
100100
time.sleep(5)
101101

102102
def close(self):
103-
self.integration.close()
103+
self.integration.close()
104+
105+
def main():
106+
fire.Fire(ans)

0 commit comments

Comments
 (0)