class NNTP::Connection
- NNTP::Connection
- Reference
- Object
Included Modules
- NNTP::Connection::Articles
- NNTP::Connection::Context
- NNTP::Connection::Groups
- NNTP::Connection::Pool
- NNTP::Connection::Search
Defined in:
nntp/connection.cr:5nntp/connection.cr:20
Constant Summary
-
Log =
::Log.for(self)
Constructors
-
.connect(host, port = 119, use_ssl = true, verify_mode : OpenSSL::SSL::VerifyMode = OpenSSL::SSL::VerifyMode::PEER, open_timeout : Int32 = 30, read_timeout : Int32 = 60, user : String | Nil = nil, secret : String | Nil = nil, method = :original) : Connection
Will initialize a new
Connection
object, configure it, then establish a connection. -
.new(uri : URI)
nntp://user:[email protected]:443/?ssl=true&verify_mode=none&method=original
- .new(host, port = 119, use_ssl = true, verify_mode : String = "peer", open_timeout : Int32 = 30, read_timeout : Int32 = 60) : Connection
- .new
Class Method Summary
Instance Method Summary
- #close
-
#configure(&)
Will yield
self
to provided block allow for variable setting. -
#connect(user : String | Nil = nil, secret : String | Nil = nil, method = :original)
Will establish a
NNTP::Socket
connection using client setting and any authentication params passed. - #connect(uri : URI)
-
#connected?
Returns
true
if a connection has been established andfalse
if not. - #host : String
- #host=(host : String)
- #open_timeout : Int32
- #open_timeout=(open_timeout : Int32)
- #port : Int32
- #port=(port : Int32)
- #read_timeout : Int32
- #read_timeout=(read_timeout : Int32)
- #use_ssl : Bool
- #use_ssl=(use_ssl : Bool)
- #verify_mode : OpenSSL::SSL::VerifyMode
- #verify_mode=(verify_mode : OpenSSL::SSL::VerifyMode)
- #with_socket(&)
Instance methods inherited from module NNTP::Connection::Pool
release
release
Instance methods inherited from module NNTP::Connection::Search
find_article_num(message_id : String, group : String | Nil = nil, batch_size = 100, offset : Int64 | Nil = nil)
find_article_num,
search_for_header(header : String, value : String, group : String | Nil = nil, batch_size = 100, offset : Int64 | Nil = nil, exact = false)
search_for_header
Instance methods inherited from module NNTP::Connection::Groups
article_ids
article_ids,
group_article_ids(group)
group_article_ids,
group_info(group) : NNTP::Context::Group
group_info,
groups : Array(String)
groups,
list_active(*args, **options)list_active(*args, **options, &) list_active, list_active_times(*args, **options)
list_active_times(*args, **options, &) list_active_times, list_distrib_pats(*args, **options)
list_distrib_pats(*args, **options, &) list_distrib_pats, list_distributions(*args, **options)
list_distributions(*args, **options, &) list_distributions, list_newsgroups(*args, **options)
list_newsgroups(*args, **options, &) list_newsgroups, list_overview_fmt(*args, **options)
list_overview_fmt(*args, **options, &) list_overview_fmt, list_subscriptions(*args, **options)
list_subscriptions(*args, **options, &) list_subscriptions, with_group(group, &) with_group
Instance methods inherited from module NNTP::Connection::Context
clear_context
clear_context,
context : NNTP::Context
context,
context? : Bool | Nil
context?,
context_start(group : String | Nil, article : Int32 | Int64 | Nil = nil)
context_start,
set_context(context : NNTP::Context)
set_context
Instance methods inherited from module NNTP::Connection::Articles
body(num : Int32 | Int64) : Array(String)body(message_id : String) : Array(String) body, headers(num : Int32 | Int64)
headers(message_id : String) headers, last last, next next, with_article(num : Int32 | Int64, &) with_article, xheader(header, message_id : String | Nil = nil)
xheader(header, num : Int64 | Int32, end_num : Int64 | Int32 | Nil = nil, all : Bool = false) xheader, xover(num : Int64 | Int32, end_num : Int64 | Int32 | Nil = nil, all : Bool = false) xover
Constructor Detail
Will initialize a new Connection
object, configure it, then establish a connection.
The created Connection
will then be returned.
client = NNTP::Connection.connect("localhost", user: "myuser", pass: "mypass")
client.connected? # => true
nntp://user:[email protected]:443/?ssl=true&verify_mode=none&method=original
Class Method Detail
Instance Method Detail
Will yield self
to provided block allow for variable setting.
Then create a new NNTP::Socket
instance (without connecting) Will return self
.
client = NNTP::Connection.new
client.configure do |c|
c.host = host
c.port = port
c.use_ssl = use_ssl
c.open_timeout = open_timeout
c.read_timeout = read_timeout
end
Will establish a NNTP::Socket
connection using client setting and any authentication
params passed.
client = NNTP::Connection.new
client.connect("MyUSER", "SuperSecret")
Returns true
if a connection has been established and false
if not.
client = NNTP::Connection.new
client.connected? # => false
client.connect
client.connected? # => true